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 1876

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

Why is the candidate composite index not used?

INDEX(library_id, firstdateofinterval) will help the query run faster. Note that the column tested by = should be first and the range should be last. Why not use the desired index? … That is, all 4 of your indexes are equivalent to simply INDEX(firstdateofinterval) when you test for a range of dates. When you used the "index hint", did it actually run any faster? Unrelated... …
Rick James's user avatar
  • 79.4k
1 vote

Is "CREATE INDEX` in MySQL a Linear Operation?

Variable #1: If MySQL chooses to build the index(es) on the fly, or wait until all the data is in, then do a sort, etc, to build the index. … Manual splitting leads to unbalanced situations -- a table scan is stuck on the data disk; an index-only operation is stuck on the index disk; a lone query first hits the index disk, then the data disk …
Rick James's user avatar
  • 79.4k
0 votes

mysql 5.5 compound index order

If it is no more than those 3 columns, then a "covering" index will be a slight benefit: INDEX(ot_id, numval1, numval2) INDEX(ot_id, numval2, numval1) Again, this leaves it to the Optimizer to dynamically … Again it leads to 2 choices: INDEX(numval1) INDEX(numval2) Or, if covering: INDEX(numval1, numval2, ot_id) INDEX(numval2, numval1, ot_id) (The last pair of columns can be in either order.) …
Rick James's user avatar
  • 79.4k
1 vote
Accepted

Mysql - index - optimization (two separate or a multikey)

Then you need INDEX(id, date) INDEX(id, type, -- in either order date) No single index handles both queries equally well. … (Based on your Comments) If (id, date) is unique, then make that the PK. and toss the other index. If (id, type, date) is unique, make it the PK and toss the other index. …
Rick James's user avatar
  • 79.4k
1 vote

Is there a situation where MySQL creates a nonclustered index automatically?

A UNIQUE key is an INDEX, plus a uniqueness constraint. (Note: may be clustered) An INDEX is a BTree that is used for efficient access. … A FOREIGN key creates an INDEX if there is not already a suitable index. (Note: Non-clustered) The 3 "Notes" are implicitly-created indexes, but not necessarily non-clustered. …
Rick James's user avatar
  • 79.4k
1 vote

Why does MariaDB choose different index use for the same data?

Run CHECK TABLE logs; -- the index may be corrupted. (This is a MyISAM-only thing to do.) Use InnoDB, not MyISAM. …
Rick James's user avatar
  • 79.4k
0 votes

How DB index works internally at high level?

Scan through the 300 index entries. If the index is very random (eg UUID), then the entries will point to lots of random places in the data. … You say "It has index on all the required columns." -- A "composite" index? Is the index_column the first column in such? If not, then much of what I said does not apply. …
Rick James's user avatar
  • 79.4k
0 votes

[Solved]MySQL index work in one table and not work in another table when using IN

When the Optimizer sees that only a "small percentage" of the index will be needed, it uses the index. … "Using index" -- Read about "covering" indexes. "Using index condition" (new in 5.6) -- This is something different. …
Rick James's user avatar
  • 79.4k
0 votes

aurora mysql index creation challenges on large tables

Index creation for a large table uses lots of disk space; memory usage is relatively stable. Are you loading that billion-row table repeatedly? Maybe we should look at ways to avoid reloading. …
Rick James's user avatar
  • 79.4k
5 votes

MySQL query not using an index when table contains many records

If that is "small" (say, less than 20%, but that is not a hard number), use the INDEX; else do a table scan. Step 1 depends on the "statistics" that are kept with the MyISAM table. … The reason for the to-INDEX-or-not-to-INDEX question goes something like this... When using the INDEX, the execution has to bounce between index 'rows' and data rows. …
Rick James's user avatar
  • 79.4k
1 vote
Accepted

Can I use an index to optimize select clause, versus where clause?

Query 1: INDEX(person_type, person_id) -- in that order INDEX(person_type, person_id, full_name) -- to be "covering" Query 2 ("covering" is not practical because of *): INDEX(person_type, full_name …
Rick James's user avatar
  • 79.4k
0 votes

Does MySQL updated index if index key is not updated?

Since AGE is not in any index, there is no INDEX will be modified. …
Rick James's user avatar
  • 79.4k
0 votes

Why full index scan over full table scan?

In this case, it is always better to do an index scan instead of a table scan. All of the needed columns are in the index; that is, it is a "covering" index. … An index and the data have essentially identical BTree structures. Scanning the index is faster because less data is handled. …
Rick James's user avatar
  • 79.4k
1 vote

Auto increment id column vs index VARCHAR columns

UUIDs are terrible when the table becomes too large to be cached. (If your table will never get very big, you can ignore the rest of my rant.) The problem comes with the randomness of UUIDs. You fe …
Rick James's user avatar
  • 79.4k
1 vote

Can i Make Index for all columns(No write operations)?

I have multiple ways to efficiently do that SELECT on that kind of a table. Yes, it involves changes to the table. And a change to the SELECT. One involves adding an AUTO_INCREMENT PRIMARY KEY and …
Rick James's user avatar
  • 79.4k

1
2 3 4 5
25
15 30 50 per page