Re: Altering a column type - Most efficient way
От
Tom Lane
Тема
Re: Altering a column type - Most efficient way
Дата
Msg-id
3462.1215786454@sss.pgh.pa.us
Ответ на
Re: Altering a column type - Most efficient way (Alvaro Herrera)
Список
Дерево обсуждения
Altering a column type - Most efficient way Ow Mun Heng <Ow.Mun.Heng@wdc.com>
Re: Altering a column type - Most efficient way Mario Weilguni <mweilguni@sime.com>
Re: Altering a column type - Most efficient way Ow Mun Heng <Ow.Mun.Heng@wdc.com>
Re: Altering a column type - Most efficient way Alvaro Herrera <alvherre@commandprompt.com>
Re: Altering a column type - Most efficient way Ow Mun Heng <Ow.Mun.Heng@wdc.com>
Re: Altering a column type - Most efficient way Alvaro Herrera <alvherre@commandprompt.com>
Re: Altering a column type - Most efficient way Tom Lane <tgl@sss.pgh.pa.us>
Re: Altering a column type - Most efficient way "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
[SOLVED] Re: Altering a column type - Most efficient way Ow Mun Heng <Ow.Mun.Heng@wdc.com>
Re: Altering a column type - Most efficient way Mario Weilguni <mweilguni@sime.com>
Alvaro Herrera writes: > Ow Mun Heng wrote: >> If it were this simple a change, I'm not certain why (I believe) PG is >> checking each and every row to see if it will fit into the new column >> definition/type. > Because the code that does the ALTER TYPE is very generic, and it > doesn't (yet) have an optimization that tells it to skip the check and > the possible table rewrite in the cases where it's obviously not needed > (like this one). Awhile back I looked into teaching ALTER TYPE that it needn't rewrite if the type conversion expression parses out as just a Var with RelabelType, but it seemed that that wouldn't cover very much of the use-cases where a human thinks that it's "obvious" that no rewrite is needed. You'd really need to build in hard-wired knowledge about the behavior of specific coercion functions, which seems entirely unappealing. regards, tom lane
В списке pgsql-performance по дате отправления