Re: constraint_exclusion not working correctly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: hmoustaid(dot)mships(at)gmail(dot)com
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: constraint_exclusion not working correctly
Date: 2024-08-16 02:26:19
Message-ID: 661806.1723775179@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

PG Doc comments form <noreply(at)postgresql(dot)org> writes:
> I have noted that, in order for constraint exclusion to work correctly when
> partitioning using inheritance, we must use simple comparisons in check
> constraints (e.g., =, >=, <=, BETWEEN, etc.). If conditions are combined
> using AND or OR, unnecessary partitions may be scanned.

> Therefore, the example in this PostgreSQL documentation will not work
> properly with constraints like CHECK (logdate >= DATE '2006-02-01' AND
> logdate < DATE '2006-03-01'). However, it will work with the BETWEEN
> operator.

The example in the documentation works perfectly well for me.

regards, tom lane

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message yanliang lei 2024-08-16 13:26:07 question about "vacuum full" command
Previous Message PG Doc comments form 2024-08-14 15:28:59 constraint_exclusion not working correctly