Re: Index and statistics not used

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: rstander(at)exa(dot)co(dot)za
Cc: Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Index and statistics not used
Date: 2021-05-17 22:31:50
Message-ID: CAApHDvpXsKGtAF3tXVu4L=XQ3o5EFWyc4tGjO4FJcPPMU2v-Jw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, 18 May 2021 at 08:42, <rstander(at)exa(dot)co(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Nagaraj Raj 2021-05-21 00:32:11 Partition with check constraint with "like"
Previous Message rstander 2021-05-17 20:42:25 Index and statistics not used