4 ms·
> Good thing SQL server features plan guides If only Postgres maintainers got this message.
by shock-value 5y ago
> Good thing SQL server features plan guides
If only Postgres maintainers got this message.
- protomyth 5y agoI remember working on a Sybase 11.5 database that basically required forcing of indexes for many tables because the query planner would always go off the rails. We had to run a script in production that would print out the query plan of the currently active queries that were taking forever. Without being able to force indexes, I have no idea how we'd of fixed the problem.
- shock-value 5y agoI like Postgres but this aspect is one of its shortcomings. In Postgres you usually have to rework your query in weird ways and hope that it's possible to get the optimizer to make the right choice. Even then, due to its usage of statistics, it could switch plans at any time as your data grows/changes.
- azth 5y agoLooks like we could use a "hint" ;-)
- asah 5y agoFYI one method is to use CTEs (WITH) to force Postgres via materialization. https://www.postgresql.org/docs/current/queries-with.html https://www.postgresql.org/docs/current/queries-with.html