Re: Slow query, possibly not using index

From: Wael Khobalatte <wael(at)vendr(dot)com>
To: Les <nagylzs(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Slow query, possibly not using index
Date: 2023-08-27 18:54:02
Message-ID: CAJZ8yobjDP8zGa4V19ydHHTbE75tV_bE2vpkLj-=j-boZ6eQZg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> Nobody ever deleted anything from this table. Since it was created, this
has been a write-only table.

does write-only include updates? that would create the dead rows tom is
referring to.

> I believe it is not actually using the index, because reading a single
(random?) entry from an index should not run for >10 minutes.

it is using the index. You can disable it, and see how long your query
takes ("set enable_indexonlyscan = off", optionally enable_indexscan too),
chances are it will take even longer. If somehow it does not, by luck, then
you no vacuum has run for a while, for some reason (perhaps canceled due to
frequent table activity?). That too you can check.

>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2023-08-27 23:34:26 Re: Slow query, possibly not using index
Previous Message Les 2023-08-27 17:39:40 Re: Slow query, possibly not using index