Details
-
Improvement
-
Resolution: Duplicate
-
Major
-
5.5.0
-
None
Description
CREATE INDEX uuidcountermax ON production_statedata(Type, UUID DESC);
|
SELECT MAX(UUID) as max
|
FROM production_statedata
|
WHERE Type = $type_name;
|
|
Above query takes time. But below query fast
SELECT UUID as max
|
FROM production_statedata
|
WHERE Type = $type_name
|
ORDER BY UUID DESC LIMIT 1; |
There is no group by and MAX() argument is in DESC order and all index keys before are equality predicates when first value found it can terminate scan.
This is similar to MB-29605
Attachments
Issue Links
- relates to
-
MB-29605 Optimize MIN aggregate without group by when KeyPos > 0
- Closed