Re: Domain check taking place unnecessarily?

2023-02-10 Thread Mark Hills
On Thu, 9 Feb 2023, Tom Lane wrote: > Mark Hills writes: > > On Wed, 8 Feb 2023, Laurenz Albe wrote: > >> It takes 30 seconds to schan the table and determine that all existing > >> rows satisky the constraint. > > > But there's no existing data (n

Re: Domain check taking place unnecessarily?

2023-02-09 Thread Mark Hills
On Wed, 8 Feb 2023, David G. Johnston wrote: > On Wed, Feb 8, 2023 at 11:01 AM Mark Hills wrote: > > > > > CREATE DOMAIN hash AS text > > CHECK (VALUE ~ E'^[a-zA-Z0-9]{8,32}$'); > > > > devstats=> ALTER TABLE invite ADD COLUMN test hash;

Re: Domain check taking place unnecessarily?

2023-02-09 Thread Mark Hills
On Wed, 8 Feb 2023, Laurenz Albe wrote: > On Wed, 2023-02-08 at 18:01 +0000, Mark Hills wrote: > > I've ruled out waiting on a lock; nothing is reported with > > log_lock_waits=on. This is a test database with exclusive access (2.5 > > million rows): > > >

Domain check taking place unnecessarily?

2023-02-08 Thread Mark Hills
I'm used to adding an empty column being instant in most cases, so my attention was drawn when it took a long lock. The timings below imply that each row is running the CHECK? I've come to expect addition of a NULL column to be fast, and what I'm seeing seems to contradict the docs [1]: > Post