Re: [PERFORM] Delete, foreign key, index usage - Mailing list pgsql-performance

From Johann Spies
Subject Re: [PERFORM] Delete, foreign key, index usage
Date
Msg-id CAGZ55DTPKuexsrzmB2T2q+PAX5TYXL3YOBwKoV6Yjv=CNeWvmA@mail.gmail.com
Whole thread Raw
List pgsql-performance


On 4 April 2017 at 14:07, Johann Spies <johann.spies@gmail.com> wrote:
While updating our database which includes a lot of deletions where a lot of foreign key references are involved we found that in the case of two tables the indexes are ignored and it slow down the process a lot.
...
 

Why would that be?

After a long time we found the problem:  The primary/foreign key fields had different types: varchar and citext.  In the case of the two tables where the indexes were ignored indexes were built with the 'citext'  type and the queries assumed it was varchar as the case were in the other tables using the same field.

Lesson learnt:  Check your types in every field in every table - and we have many tables.

Regards
Johann


--
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

pgsql-performance by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: [PERFORM] Query is very much slow
Next
From: Dinesh Chandra 12108
Date:
Subject: FW: Re: [PERFORM] Query is running very slow......