Re: Index and statistics not used - Mailing list pgsql-performance

From David Rowley
Subject Re: Index and statistics not used
Date
Msg-id CAApHDvpXsKGtAF3tXVu4L=XQ3o5EFWyc4tGjO4FJcPPMU2v-Jw@mail.gmail.com
Whole thread Raw
In response to Index and statistics not used  (<rstander@exa.co.za>)
List pgsql-performance
On Tue, 18 May 2021 at 08:42, <rstander@exa.co.za> wrote:
> Running delete from table1 where id = 48938 the trigger for constraint runs for 20 seconds
>
> Event when doing a simple select from table2 where table1_id = 48938 takes about 8 seconds

Does EXPLAIN show it uses a seq scan for this 8-second SELECT?

If so, does it use the index if you SET enable_seqscan TO off; ? If
so, how do the costs compare to the seqscan costs?

Is random_page_cost set to something sane? Are all the indexes valid?
(psql's \d table2 would show you INVALID if they're not.)

does: SHOW enable_indexscan; show that index scanning is switched on?

David



pgsql-performance by date:

Previous
From:
Date:
Subject: Index and statistics not used
Next
From: Nagaraj Raj
Date:
Subject: Partition with check constraint with "like"