Re: Why isn't PG using an index-only scan?

From: Jean-Christophe BOGGIO <postgresql(at)thefreecat(dot)org>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Why isn't PG using an index-only scan?
Date: 2025-09-18 07:45:13
Message-ID: 63d65775-0130-4c5c-a151-8d7728b6d4e8@thefreecat.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thanks David,

Le 18/09/2025 à 09:20, David Rowley a écrit :
> Yes. Since *all* records of "oeu" are required and they're not
> required in any particular order, then Seq Scan should be the fastest
> way to access those records.

Ok but then why is it doing it on the AD table? Is it because of the
number of rows?

> 5 hours seems very slow for the estimated number of records. Have you
> tried running the SELECT using EXPLAIN ANALYZE without the INSERT
> part? Even if the 84 million Merge Join row estimate is accurate, 5
> hours seems excessively long.

I tried this, it took 1 second. And then I discovered that I had an old
trigger on the copyrightad table.

The insert took 2 seconds.

Very sorry for wasting your time and thanks again for putting me on the
right track.

Have a great day!

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Andrei Lepikhov 2025-09-18 07:55:57 Re: Why isn't PG using an index-only scan?
Previous Message David Rowley 2025-09-18 07:20:46 Re: Why isn't PG using an index-only scan?