| From: | "John Bachir" <j(at)jjb(dot)cc> | 
|---|---|
| To: | "Sergei Kornilov" <sk(at)zsrv(dot)org>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> | 
| Subject: | Re: feature idea: use index when checking for NULLs before SET NOT NULL | 
| Date: | 2020-05-29 12:08:22 | 
| Message-ID: | 23ae4bef-87f2-4144-b9cc-5b13b78797b5@www.fastmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Wow! Thank you Sergei for working on this patch, for working for months/years to get it in, and for replying to my email!
For others reading this later:
- the feature was introduced in 12
- the commit is here https://github.com/postgres/postgres/commit/bbb96c3704c041d139181c6601e5bc770e045d26
Sergei, a few questions:
- Just to be clear, your recipe does not require any indexes, right? Because the constraint check table scan is inherently concurrent?
- Was this new behavior mentioned in the release nose?
- Do you know if there are any blog posts etc. discussing this? (I'm definitely going to write one!!)
John
> 
> But the answer in SO is a bit incomplete for recent postgresql 
> releases. Seqscan is not the only possible way to set not null in 
> pg12+. My patch was commited ( 
> https://commitfest.postgresql.org/22/1389/ ) and now it's possible to 
> do this way:
> 
> alter table foos 
>      add constraint foos_not_null 
>      check (bar1 is not null) not valid; -- short-time exclusive lock
> 
> alter table foos validate constraint foos_not_null; -- still seqscan 
> entire table but without exclusive lock
> 
> An then another short lock:
> alter table foos alter column bar1 set not null;
> alter table foos drop constraint foos_not_null;
> 
> regards, Sergei
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2020-05-29 12:45:44 | Re: OpenSSL 3.0.0 compatibility | 
| Previous Message | Peter Eisentraut | 2020-05-29 11:34:49 | Re: OpenSSL 3.0.0 compatibility |