ALTER TEXT field to VARCHAR(1024)

Поиск
Список
Период
Сортировка
От Marius Grama
Тема ALTER TEXT field to VARCHAR(1024)
Дата
Msg-id CAFYRqM+JTLEU=p3C1cW90Tskw-19dWkdtxJV0y6ETU4BB8w=8A@mail.gmail.com
обсуждение исходный текст
Ответы Re: ALTER TEXT field to VARCHAR(1024)  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
Re: ALTER TEXT field to VARCHAR(1024)  (Bill Moran <wmoran@potentialtech.com>)
Список pgsql-general
Hello,


i am using Postgres 9.2 and I'd like to perform the following ALTER statement on a database table with about 30M entries :

ALTER TABLE images ALTER COLUMN mask_descriptors TYPE VARCHAR(1024);


The mask_descriptors field is currently having the type TEXT.
I want to perform the ALTER due to the fact that it seems that copying the contents of the table to a BI SQL Server is done in row by row (instead of batch) when handling CLOBs.

From the Postgres documentation I got the following :

http://www.postgresql.org/docs/8.3/static/datatype-character.html

Tip: There are no performance differences between these three types, apart from increased storage size when using the blank-padded type, and a few extra cycles to check the length when storing into a length-constrained column. While character has performance advantages in some other database systems, it has no such advantages in PostgreSQL. In most situations text or character varying should be used instead.



Can anybody explain me what happens in the background when the alter statement is executed? I've tried it out on a small copy of the table (70K) and the operation completed in 0.2 seconds.
Will the table be completely locked during the execution of the ALTER statement?



В списке pgsql-general по дате отправления:

Предыдущее
От: Albe Laurenz
Дата:
Сообщение: Re: cloning database
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [SQL] pg_multixact issues