S
S
synapse_people2019-09-07 12:58:37
MySQL
synapse_people, 2019-09-07 12:58:37

Do you need an index or not?

There is a table

ns binary(16) , obj binary(16), created_at unsigned int
в ней PK = (ns, obj)

Please advise when requested
select ... from tbl where ns=0x00.... ORDER BY created_at DESC

(there are also queries without sorting at all)
Do we need separate indexes for ns&created_at fields or not?
-That is, ns will be taken from PK or not?
- Is an index needed for created_at? Will it speed up the sampling or not?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman MySQL, 2019-09-07
@synapse_people

still visible in EXPLAIN SELECT))
Yes. but still could be a filesort in the plan
yes
Add index (NS, CREATED_AT DESC)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question