Don't use the timestamp type to store timestamps, use timestamptz (also known as timestamp with time zone) instead.
6 Matching Annotations
- Mar 2025
-
wiki.postgresql.org wiki.postgresql.org
-
-
Don't use the type varchar(n) by default. Consider varchar (without the length limit) or text instead.
-
-
-
stackoverflow.com stackoverflow.com
-
79 View upvote and downvote totals. This answer is not useful Save this answer. Show activity on this post. Generally, there is no downside to using text in terms of performance/memory. On the contrary: text is the optimum. Other types have more or less relevant downsides. text is literally the "preferred" type among string types in the Postgres type system, which can affect function or operator type resolution.
-
-
dba.stackexchange.com dba.stackexchange.com
-
Don't add a length modifier to varchar if you don't need it. (Most of the time, you don't.) Just use text for all character data. Make that varchar (standard SQL type) without length modifier if you need to stay compatible with RDBMS which don't have text as generic character string type.
-
-
dba.stackexchange.com dba.stackexchange.com
-
I rant against 255 occasionally. Sure, there used to be some reasons for '255', but many are no longer valid, and even counter-productive.
-