Re: [HACKERS] Validating CHECK constraints with SPI

2014-10-29 Thread Noah Misch
On Wed, Oct 29, 2014 at 10:24:26AM -0400, Tom Lane wrote: > Dan Robinson writes: > > Since the table is locked to updates while the constraint is validating, > > this means you have to jump through hoops if you want to add a CHECK > > constraint to a large table in a production setting. This valid

Re: [HACKERS] Validating CHECK constraints with SPI

2014-10-29 Thread Dan Robinson
On Wed, Oct 29, 2014 at 7:17 AM, Alvaro Herrera wrote: > Dan Robinson wrote: > > Hi all, > > > > If I'm reading correctly in src/backend/commands/tablecmds.c, it looks > like > > PostgreSQL does a full table scan in validateCheckConstraint and in the > > constraint validation portion of ATRewrite

Re: [HACKERS] Validating CHECK constraints with SPI

2014-10-29 Thread Tom Lane
Dan Robinson writes: > Since the table is locked to updates while the constraint is validating, > this means you have to jump through hoops if you want to add a CHECK > constraint to a large table in a production setting. This validation could > be considerably faster if we enabled it to use relev

Re: [HACKERS] Validating CHECK constraints with SPI

2014-10-29 Thread Alvaro Herrera
Dan Robinson wrote: > Hi all, > > If I'm reading correctly in src/backend/commands/tablecmds.c, it looks like > PostgreSQL does a full table scan in validateCheckConstraint and in the > constraint validation portion of ATRewriteTable. > > Since the table is locked to updates while the constraint

[HACKERS] Validating CHECK constraints with SPI

2014-10-29 Thread Dan Robinson
Hi all, If I'm reading correctly in src/backend/commands/tablecmds.c, it looks like PostgreSQL does a full table scan in validateCheckConstraint and in the constraint validation portion of ATRewriteTable. Since the table is locked to updates while the constraint is validating, this means you have