Re: Are indices used for creating check constraints? - Mailing list pgsql-general

From Tom Lane
Subject Re: Are indices used for creating check constraints?
Date
Msg-id 83722.1540231938@sss.pgh.pa.us
Whole thread Raw
In response to Are indices used for creating check constraints?  (Dinko Papak <rimokatolik@outlook.com>)
List pgsql-general
Dinko Papak <rimokatolik@outlook.com> writes:
> Here are 3 interesting (to me) numbers:
> 1. creating index on expression (func(timestamp)) takes 5 seconds
> 2. creating check constraint on the same expression takes 10 seconds
> 3. adding partition table based on the same expression without check expression takes 20 seconds (this has been
resolvedby answer from David Rowley) 

Hmm ...

> Is it possible to use indices to create check expressions?

No.

> Why is 2. twice as long as 1.?

Good question.  Could you provide a concrete test case?

            regards, tom lane


pgsql-general by date:

Previous
From: Dinko Papak
Date:
Subject: Are indices used for creating check constraints?
Next
From: Boris Sagadin
Date:
Subject: Re: Postgres 10, slave not catching up with master