I am doing a query that orders the result on a Boolean field (TINITT (1)). It has been indexed.
It takes 1.61 seconds to run. If I do the same query without the ORDER BY
, it takes a fraction of the time:
It takes 4.1ms to complete. Why does it take too much time to do it on a Boolean field on PK?
Why does it take so much time to sort on boolean field over a PK?
It is easy to have an index in the primary key that makes it possible to get a record in sequential order without doing any of the following. You have a simple query, so this index can be used for retrieval. is. (An additional customization is because the rows are in the primary key sequence, but this is a small additional advantage than being an index.)
You can create an index at main_catalog (is_tv_on_itunes) < / Code> or anything similar to additional fields.
And, for bus records only, query:
SELECT * FROM 'main_catalog` LIMIT 1
on the primary key No sort results in a given query are not guaranteed to happen in a particular order if you want them in the primary key sequence, then the order
statement to guarantee you Need to add
Comments
Post a Comment