Changes between Version 4 and Version 5 of Ticket #23242, comment 10
- Timestamp:
- Dec 17, 2017, 10:20:27 AM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #23242, comment 10
v4 v5 1 1 While it's still possible that getting rid of the the `DISTINCT` generated by `dates()` might help I wonder, by looking at the provided PostgreSQL plan in comment:3, if the actual culprit of the slow query was the `EXTRACT('month')` all along as related in #28933. 2 2 3 I also wonder if `LIMIT`'ing the results to `12` in in the case of `year&month` might help the database engine engine figure out that it can stop the `DISTINCT` processing once it retrieved 12 results. 3 I also wonder if `LIMIT`'ing the results to `12` in in the case of `year&month` might help the database engine engine figure out that it can stop the `DISTINCT` processing once it retrieved 12 results. The `ORDER BY` clause would have to be dropped here or wrapped around the `LIMIT`ed query. 4 4 5 5 Another option would to stop using `dates` (or allow passing a range to it) for `year&month` and `year&month&day` filtering and use a combination of `generate_series` and `EXISTS` to speed up the query.