Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 61

A database structure that can improve the speed of queries at the cost of disk space and slower inserts/updates. It stores a copy of one or more columns sorted but structures the data differently to allow faster access.

1 vote
Accepted

Reduce page accesses of query

If clustering is not supported, or you want the one clustered index on the table for something else, then again you'd need to use a wide covering index or an index that INCLUDEs all the other columns. … table index order with the CLUSTER command …
David Spillett's user avatar
1 vote

Best way to solve a lot of queries stuck because of no index

index is the only solution. … Perhaps go for an online index build if possible - that will take longer but won't completely block part of the application while it does the job. …
David Spillett's user avatar
9 votes

What does "index" mean on RDBMSs?

to use a combined index if present. … If you only have an index on each individually but no combined index the DB will either search one or the other index and separately filter the results with the second clause, or scan both and marry the …
David Spillett's user avatar
16 votes
Accepted

Is "CREATE INDEX` in MySQL a Linear Operation?

Index creation is essentially a sort operation, so is at best has a growth complexity of the order n log n on average (you might find it does better in some cases, and is not likely to do much worse). … If all your relevant data pages fit into RAM and are already in RAM, and the index will fit also, and your DBMS does not force index pages to be written before the creation is complete (so index blocks …
David Spillett's user avatar
6 votes
Accepted

Is there any performance difference between UNIQUE INDEX and INDEX with the same cardinality...

There will be no difference for read operations, once written the entries in the index will be the same. … Only create a unique index for values that you know should be unique. …
David Spillett's user avatar
2 votes

Index on an input value without saving it to a column?

Postgres supports indexes on expressions so if the value you want to index can be computed from other values in the row this will work (assuming the queries you are using a written in a way that the query … planner can see the use for the index). …
David Spillett's user avatar
28 votes
Accepted

Do I need separate indexes for each type of query, or will one multi-column index work?

You are right in that your example query would not use that index. … If you do define [customerId], [dateCreated] as an index, for example, remember that the query planner will be able to use that for queries that would use an index on just [customerId] if present. …
David Spillett's user avatar
-1 votes

Does adding a non clustered index to foreign key speed up the join?

With an index on Sales.UID it will likely scan users and be able to join using sales more efficiently because the joining field is pre-sorted by the index. … If you are likely to search by date rather than listing all sales, then an index with Sales.Date as the first covered column might be more helpful. …
David Spillett's user avatar
1 vote

Why would deleting a redundant index cause an application to perform unexpectedly?

Would creating an nonclustered index with the same column(s) as the clustered index be the most efficient? … What does the optimizer do in this case - does it still make a plan to include these "bad" indexes that just reference the clustered index, or will it know to ignore the with(index) request? …
David Spillett's user avatar
4 votes

How to create a conditional index in MySQL?

Essentially you would be manually partitioning the table (and appying the index to only one of the partitions). … You could maintain an extra column with an index and only have a value in that column when the condition you want the index to be based upon is true, but this is likely to be labour intensive and of limited …
David Spillett's user avatar
1 vote

Question about non-clustered index storage in SQL Server

heap or clustered index) once a row matches all the predicates that the index could satisfy. … by the index. …
David Spillett's user avatar
5 votes

How to minimize the need for recalculating index on SQL Server?

I asume by "recalculating" you are referring to completely rebuilding an index. … You can reduce the affect of index rebuilds if you have Enterprise Edition by using online index builds - there will still be a time were the table is locked as the newly generated index is attached to …
David Spillett's user avatar
1 vote
Accepted

same field in bothe "where" and "order by" - how to index for this query?

I think the problem stopping an index on time being used for filtering is the use of a function with a reference to the row: COALESCE(?, time). …
David Spillett's user avatar
1 vote

Index on integer column not helping. Help? (EXPLAIN ANALYZE output inside)

With only 5 values the index isn't honing to be very selective for joining so it'll pretty much always index scan unless looking for just one value. … If it is index scanning anyway you might find it faster to do that and then filter out the two you are not looking for results for. …
David Spillett's user avatar
2 votes

Postgres indexes for 75 columns

If laurenz's suggestion of enforcing limitations is not possible for your product, because users will kick back or other stake-holders within the client (as you are not likely talking directly to the …
David Spillett's user avatar

15 30 50 per page