Is it possible to add index to a temp table? And what’s the difference between create #t and declare @t

#tablename is a physical table, stored in tempdb that the server will drop automatically when the connection that created it is closed, @tablename is a table stored in memory & lives for the lifetime of the batch/procedure that created it, just like a local variable. You can only add a (non PK) index to a … Read more

Can I optimize a SELECT DISTINCT x FROM hugeTable query by creating an index on column x?

This is likely not a problem of indexing, but one of data design. Normalization, to be precise. The fact that you need to query distinct values of a field, and even willing to add an index, is a strong indicator that the field should be normalized into a separate table with a (small) join key. … Read more

Using Angular2 ngFor index

Angular does not provide this functionality out of the box. I think that the simplest way to achieve the desired result is to only display data on every third index like so: <div class=”list-group”> <div *ngFor=”let p of products; let idx = index” > <div class=”row” *ngIf=”idx % 3 === 0″> <app-product [product]=”products[idx]”></app-product> <app-product [product]=”products[idx+1]”></app-product> … Read more

How do I know if my PostgreSQL server is using the “C” locale?

Currently some locale [docs] support can only be set at initdb time, but I think the one relevant to _pattern_ops can be modified via SET at runtime, LC_COLLATE. To see the set values you can use the SHOW command. For example: SHOW LC_COLLATE _pattern_ops indexes are useful in columns that use pattern matching constructs, like … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)