logoalt Hacker News

foxhill • today at 3:18 PM • 1 reply • view on HN

plan hinting is a crutch. a useful one to have, and lifesaver when you need it, but a crutch nonetheless.

what i wish postgres would do is to replan when it wildly mis-estimates row counts in deeply nested queries. just because you decided on a linear scan join when you thought that sub-query had 4 rows, doesn’t mean you need to commit to it when that sub-query turns out to actually have 4 million rows.

if you need query plan hints, it’s most likely because some aspect of postgres’ statistics about your tables is very out of line. and, given the very nature of stats collection, i.e., it being a lossy process, there are many distributions of data that it simply cannot detect & accurately account for.


Replies

nopurpose • today at 5:57 PM

One can only dream. For now it is entirely lost even if you pass `LIMIT $1` as a bind parameter.