Re: adding a column takes FOREVER!

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: adding a column takes FOREVER!
Дата
Msg-id 19079.1320204477@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: adding a column takes FOREVER!  (Eric Smith <eric_h_smith@mac.com>)
Ответы Re: adding a column takes FOREVER!  (Eric Smith <eric_h_smith@mac.com>)
Список pgsql-general
Eric Smith <eric_h_smith@mac.com> writes:
> Thank you for the response... to be perfectly honest, I don't know enough to know what I'm not telling you.  Below is
thestring I use to create the table, so you can see the contents.  I don't think I have foreign key references or
triggersof any kind.  Any ideas? (this is 8.3 running on Mac OS 10.7) 

I'm wondering how much data is hiding behind this column:

>     [tableString appendString:@"\"imageData\" bytea null,"];

Since you're installing a non-null column default value, the ALTER TABLE
ADD COLUMN command has to rewrite the entire table.  If there are large
images hiding in each of those "only 14000" rows, there'd be a lot of
data to copy over and so it could take awhile.

(In contrast, ADD COLUMN without a default value is speedy because
Postgres plays some tricks to avoid rewriting the table data.  That
won't help you if you have to install non-null values in the new
column, but it's good to know that there's a difference.)

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Subselects in select expressions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: variable not found in subplan target list