| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Arik Schimmel <arik(dot)schimmel(at)wiz(dot)io> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Question about partial index WHERE clause predicate ordering |
| Date: | 2025-12-27 04:15:11 |
| Message-ID: | 1631331.1766808911@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Arik Schimmel <arik(dot)schimmel(at)wiz(dot)io> writes:
> Is there a reason partial index predicates aren't reordered by cost?
It hasn't come up AFAIR. I'm dubious that it'd be worth the trouble,
because order_qual_clauses is really quite crude when dealing with
simple expressions. We don't have accurate costing data for most
functions/operators --- they're all just labeled with procost 1 ---
so that the "cost-based ordering" reduces to just counting the
functions. That gets the right answer in your example, but only
accidentally IMO; it has no idea that jsonb_extract_path_text()
is particularly expensive. order_qual_clauses exists mostly to
ensure that subplans get pushed to the end, and that's not relevant
in this context because we don't support those in indexes.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | zengman | 2025-12-27 04:58:43 | Re:Question about partial index WHERE clause predicate ordering |
| Previous Message | jian he | 2025-12-27 03:00:36 | Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object |