Earlier quoted context omitted.
MySQL offers this via use/force index (…). Similar problem where the QP will inexplicably decide one day to make a query really slow and you gotta override it.
We have a couple queries where using the correct index they'll take milliseconds, using the wrong index it'll take minutes - and mysql occasionally enough to be a noticeable load on the database chooses the wrong one and we've specified "USE INDEX" even though I really hate having to do so.
Postgres is eating the database world
11–20 of 147 posts
Re: Postgres is eating the database world
#12Postgres is simply the best. One thing I would like however is the ability to have control over the query planner for specific tasks. There is a dark art to influencing the query planner, but essentially it is unpredictable, and postgres can get it consistently wrong in certain scenarios. If you could just enable a special query mode that gives you absolute control over the QP for that query, it would solve a major p…
pg_hint_plan —— Give PostgreSQL ability to manually force some decisions in execution plans. https://github.com/ossc-db/pg_hint_plan
---
Just did a HN submission for it (https://news.ycombinator.com/item?id=39712211) now too.
Re: Postgres is eating the database world
#13Earlier quoted context omitted.
I’m currently learning the basics of this. Currently struggling with multiple similar scenarios where switching from a left to an inner join, or any equivalent, kills performance. But these are aggregation queries so there are only 5 records returned. I could just filter in my app code no problem. But why the hell does adding “where foo.id is not null” in SQL make it O(N*M)??? CTEs are not helping.
Have you checked with EXPLAIN ANALYZE VERBOSE?
Re: Postgres is eating the database world
#14Earlier quoted context omitted.
I haven’t used Postgres but is this the issue you’re talking about? https://github.com/launchbadge/sqlx/pull/1539
No this is a fundamental concept in postgres. If you do EXPLAIN ANALYZE on a query, you get the query plan, which is influenced by the query, indexes, table structure, etc. But the QP may decide to do a silly thing like a sequential scan where a better path exists, and adding an index to avoid the scan would be cost prohibitive. So if you could just override the QP and say "Use this index and do this type of sort and…
Re: Postgres is eating the database world
#15Re: Postgres is eating the database world
#16Re: Postgres is eating the database world
#17Earlier quoted context omitted.
Have you checked with EXPLAIN ANALYZE VERBOSE?
Yup, used a nice EXPLAIN GUI tool as well to try and help.
* Usually I've been able to force query plans by disabling whole operations for a session, such as disallowing "sort" to make it use an index. The real fix in this case, for example, was to use CLUSTER to re-order data on disk, so the correlation statistic was close to 1 and postgres wanted to use the index instead of table scan + sort.
Re: Postgres is eating the database world
#18Alright I'm convinced, I'm using postgres for my next project. Anyone have any experiences with it and Entity Framework Core?
Re: Postgres is eating the database world
#19The feature I'd love to see added that has been kicking around the mailing list for ages now would be incremental view maintenance.
Being able to keep moderately complex analysis workloads fresh in realtime would be such a boon.
Re: Postgres is eating the database world
#20Alright I'm convinced, I'm using postgres for my next project. Anyone have any experiences with it and Entity Framework Core?