pg.ddx.io pgsql-docs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
constraint_exclusion not working correctly 2+ messages / 2 participants [nested] [flat]
* constraint_exclusion not working correctly @ 2024-08-14 15:28 PG Doc comments form <noreply@postgresql.org> 0 siblings, 1 reply; 2+ messages in thread From: PG Doc comments form @ 2024-08-14 15:28 UTC (permalink / raw) To: pgsql-docs@lists.postgresql.org; +Cc: hmoustaid.mships@gmail.com The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/16/ddl-partitioning.html Description: Hello, 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. Regards ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: constraint_exclusion not working correctly @ 2024-08-16 02:26 Tom Lane <tgl@sss.pgh.pa.us> parent: PG Doc comments form <noreply@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2024-08-16 02:26 UTC (permalink / raw) To: hmoustaid.mships@gmail.com; +Cc: pgsql-docs@lists.postgresql.org PG Doc comments form <noreply@postgresql.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 ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-08-16 02:26 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-08-14 15:28 constraint_exclusion not working correctly PG Doc comments form <noreply@postgresql.org> 2024-08-16 02:26 ` Tom Lane <tgl@sss.pgh.pa.us>
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