Question about ALTER TABLE SET TABLESPACE locing behaviour

Started by Hannu Krosingalmost 20 years ago4 messages
#1Hannu Krosing
hannu@skype.net

Does ALTER TABLE SET TABLESPACE lock the table while copying data to new
location ?

If so, then does it lock the whole table, or just the tuples belonging
to currently copied 1G file ?

----------------
Hannu

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hannu Krosing (#1)
Re: Question about ALTER TABLE SET TABLESPACE locing behaviour

Hannu Krosing <hannu@skype.net> writes:

Does ALTER TABLE SET TABLESPACE lock the table

It had better ... see nearby discussion about relaxing locking for
TRUNCATE. Exactly the same problem that at commit we'd be cutting
the ground out from under any concurrent query.

regards, tom lane

#3Hannu Krosing
hannu@skype.net
In reply to: Tom Lane (#2)
Re: Question about ALTER TABLE SET TABLESPACE locing

Ühel kenal päeval, K, 2006-02-01 kell 18:08, kirjutas Tom Lane:

Hannu Krosing <hannu@skype.net> writes:

Does ALTER TABLE SET TABLESPACE lock the table

It had better ... see nearby discussion about relaxing locking for
TRUNCATE.

Is it some recent disussion ?

Exactly the same problem that at commit we'd be cutting
the ground out from under any concurrent query.

Can't we just keep READ locks and reopen the datafile from its new
location before releasing it ?

Does our shared memory page cache implementation track logical or
physical pages ? If it's just logical pages, then moving the physical
storage around below should not affect it.

Of course there are problems with WAL/PITR which *have* to deal with
physical storage, but this should be mostly unrelated.

--------------
Hannu

#4Kim Bisgaard
kib+pg@dmi.dk
In reply to: Hannu Krosing (#3)
Re: Question about ALTER TABLE SET TABLESPACE locing

Hannu Krosing wrote:

Ühel kenal päeval, K, 2006-02-01 kell 18:08, kirjutas Tom Lane:

Hannu Krosing <hannu@skype.net> writes:

Does ALTER TABLE SET TABLESPACE lock the table

It had better ... see nearby discussion about relaxing locking for
TRUNCATE.

Is it some recent disussion ?

it is "[PERFORM] partitioning and locking problems" (on the performance
list)

Regards,