-
Notifications
You must be signed in to change notification settings - Fork 110
Description
Hello! I have a question about row estimates.
In Hints for Row number corrections, I see the examples all show a way to fix postgres' resulting estimate.
But I am looking for a way to hint that the resulting row number estimate of the join a b
is the number of estimated rows for a
.
I have never used pg_hint_plan (sorry, maybe I should install it and try it out myself), but thought it might be good to have this documented if it is supported.
Would Rows(a b a)
work?
Thanks in advance.
Use-case if it helps:
We have a join based on a computed value that does not have statistics, e.g. extract_latest_less_than(table_a.array_of_b_ids, $1) = b.id
. Since $1
is a query parameter that changes a lot, this can't be a computed column with statistics. But we know that function will return an Id that exists in b
, something Postgres can't know. Postgres will treat it as an arbitrary integer and will produce very low and wrong row estimates.