Re: query plan ignoring check constraints

From: "John Hansen" <john(at)geeknet(dot)com(dot)au>
To: "Bruno Wolff III" <bruno(at)wolff(dot)to>
Cc: "Simon Riggs" <simon(at)2ndquadrant(dot)com>, "Alvaro Herrera" <alvherre(at)surnet(dot)cl>, "Josh Berkus" <josh(at)agliodbs(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: query plan ignoring check constraints
Date: 2005-06-21 11:54:34
Message-ID: 5066E5A966339E42AA04BA10BA706AE50A9364@rodrick.geeknet.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruno Wolff III [mailto:bruno(at)wolff(dot)to] Wrote

> I think the real problem is that check constraints on tables
> aren't used by the optimizer. Given that, what you have below
> is expected.
> There has been talk about that in the past, but I haven't
> heard anything recently about someone considering implenting that.
>
> For your problem consider not using a partial index. It isn't
> going to save anything if it has a constraint matching that
> of the table.

Ahh, I get it now,...

If a column has a CHECK (col IN (1,2,3)) and a query says .. WHERE col
= 4; then the planner should
know that the query will return 0 rows, right?

... John

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2005-06-21 11:59:38 Re: thousands comma numeric formatting in psql
Previous Message Stephen Frost 2005-06-21 11:53:57 Re: Schedule for 8.1 feature freeze