Use index to estimate expression selectivity

From: Bono Stebler <bono(dot)stebler(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Use index to estimate expression selectivity
Date: 2023-11-23 11:55:58
Message-ID: db61d596-41bc-4d5b-a4a2-30f7c51a5854@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear hackers,

After discussing the issue on irc, it looks like it could be possible
for the planner to use a partial index matching an expression exactly to
estimate its selectivity.

Here is a simplified version (thanks ysch) of the issue I am facing:

https://dbfiddle.uk/flPq8-pj

I have tried using CREATE STATISTICS as well but haven't found a way to
improve the planner estimation for that query.

I have worked around the problem for my specific use case but that
behavior is counter-intuitive, is there any interest in improving it?

Thank you!

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2023-11-23 12:15:22 RE: Random pg_upgrade test failure on drongo
Previous Message Heikki Linnakangas 2023-11-23 11:35:16 Re: WaitEventSet resource leakage