On Tue, Feb 6, 2024 at 2:40 PM veem v <veema0...@gmail.com> wrote: > Thank you Laurenz. Got it. > > So basically , you mean to say any DDL on a table won't allow the table to > be read by other processes. I was under the assumption that it should allow > the read queries to move ahead at least. I must be wrong here. Thanks for > correcting me. >
That word "any" in "any DDL" is quite a big word. It's certainly not going to allow reads while you're adding a Foreign Key. And the whole purpose of adding the CONCURRENTLY key word to CREATE INDEX is because regular CREATE INDEX statements block everyone else. https://www.postgresql.org/docs/16/sql-createindex.html Look for the keyword CONCURRENTLY in https://www.postgresql.org/docs/current/sql-altertable.html