| From: | Alexey Ermakov <alexius(dot)work(at)gmail(dot)com> |
|---|---|
| To: | Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org |
| Subject: | Re: postgres chooses objectively wrong index |
| Date: | 2026-03-17 22:16:30 |
| Message-ID: | e0d87b50-8a38-4e25-bc88-86aa83029afb@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
On 2026-03-18 03:01, Merlin Moncure wrote:
> I've been maintaining an airflow style orchestrator in pl/pgsql, and
> it's revealed a performance issue I just can't solve. There is a
> table, task, which may normally contain billions of rows, but only a
> tiny portion is interesting for specific reasons—a common pattern in
> task-type systems.
>
> ...
>
> I'm wondering if there are other tricks that might apply here, for
> example, multi column index statistics...curious if anyone has
> thoughts on that.
>
> Any suggestions?
>
> merlin
>
Hello. I think planner doesn't have information about distribution of
*async.task_execution_state(task)* unless it's part of any full index. I
would try to give that with extended statistics (postgresql 14+):
create statistics (mcv) task_task_execution_state_stat on ((async.task_execution_state(task))) from async.task;
analyze async.task;
If that won't help - please show distribution from pg_stats_ext view for
extended statistic above.
--
Alexey Ermakov
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-03-17 22:24:28 | Re: postgres chooses objectively wrong index |
| Previous Message | Merlin Moncure | 2026-03-17 21:01:09 | postgres chooses objectively wrong index |