pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dinko Papak <rimokatolik@outlook.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Are indices used for creating check constraints?
Date: Mon, 22 Oct 2018 14:12:18 -0400
Message-ID: <83722.1540231938@sss.pgh.pa.us> (raw)
In-Reply-To: <CY4PR0101MB31750EF1C65CDC3680AF516DBAF40@CY4PR0101MB3175.prod.exchangelabs.com>
References: <CY4PR0101MB31750EF1C65CDC3680AF516DBAF40@CY4PR0101MB3175.prod.exchangelabs.com>

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 resolved by 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




view thread (2+ messages)

Message-ID: <83722.1540231938@sss.pgh.pa.us>
Permalink:  ../83722.1540231938@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/83722.1540231938@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rimokatolik@outlook.com
  Subject: Re: Are indices used for creating check constraints?
  In-Reply-To: <83722.1540231938@sss.pgh.pa.us>
  References: <CY4PR0101MB31750EF1C65CDC3680AF516DBAF40@CY4PR0101MB3175.prod.exchangelabs.com> <83722.1540231938@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox