Search Results
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 |
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.
231
votes
Accepted
When should I use a unique constraint instead of a unique index?
If you are planning to use the index as an index (i.e. your code may rely on searching/sorting/filtering on that field to be quick) I would explicitly use a unique index (and comment the source) rather … Also a specific index can be named in an index hint (i.e. …
80
votes
Accepted
Index Seek vs Index Scan
Index Scans with Row Lookups: With no index that can be directly used for a seek is found but an index containing the right columns is present an index scan may be used. … Index Seeks (with or without row lookups): In a seek not all of the index is considered. …
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. …
18
votes
Why does MySQL not have hash indices on MyISAM or InnoDB?
on disk is a very heavy operation (and IIRC mySQL doesn't support live index rebuilds so holds a table lock during the operation). … more efficient for large strings (where computing the hash value and searching the tree index by this value is always likely to be faster then just searching a tree index using the larger values for comparison …
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 …
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 …
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. …
6
votes
DATEADD not producing a SARGable expectation of an index seek
A "kitchen sink" query like that (multiple distinct filtering clauses one or more of which is used depending on the value of an input) is never going to be sargable even if all its individual clauses …
6
votes
Accepted
Does the length of the index name have any performance impact?
There will be a very very small difference in parsing time for statements that specifically mention the index or generating output that mention the index, but this is so vanishingly small compared to all … When the index name is not explicitly used then even that difference is gone: the index will be looked up by the columns it contains data for not by its name. …
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 …
5
votes
Accepted
SQLite - Should I add some indexes even if select queries are fast?
Now, tables have max 5k rows and in future they may go maximum up to 100k rows
In cases like this, where time and resource permits, the best way to check this is to manufacture realistic looking …
5
votes
Index before or after bulk load using load infile?
The amount of work to maintain the balance of the tree structures for each index is fairly high and depending on insert order can result in both significant index fragmentation (i.e. the location of pages … Also if there is existing data dropping index and constraints will be a problem if there are user actively using the system(s) the database backs. …
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 …
4
votes
How can I speed up this query?
An index on region may help, but not a lot unless that column is quite selective (or at all if the majority of the rows are from the region you are looking at). … With that change in place, a combined index on both timestamp and region is likely to be most helpful here. …
4
votes
Accepted
Recommended number of index for a table
If you have more than ten columns (or combinations of columns as an index can cover several) that are regularly searched by then you probably need more than 10 indexes. …