|
|
|
|
|
by alex_smart
858 days ago
|
|
>The author effectively wastes many words trying to prove a non-existent performance difference and then concludes "there is not much performance difference between the two types". They then also show that there is in fact a significant performance difference when you need to migrate your schema to accodomate a change in length of strings being stored. Altering a table to a change a column from varchar(300) to varchar(200) needs to rewrite every single row, where as updating the constraint on a text column is essentially free, just a full table scan to ensure that the existing values satisfy your new constraints. FTA: >So, as you can see, the text type with CHECK constraint allows you to evolve the schema easily compared to character varying or varchar(n) when you have length checks. |
|
Which is a pointless demonstration if you RTFM and design your schema correctly, using text, just like the manual and the wiki tells you to.
> the text type with CHECK constraint allows you to evolve the schema easily compared to character varying or varchar(n) when you have length checks.
Which is exactly what the manual tells you ....
"For many purposes, character varying acts as though it were a domain over text"