cancel
Showing results for 
Search instead for 
Did you mean: 

Use 'text' instead of 'varchar' in PostgreSQL 9.x

edsonrichter
Confirmed Champ
Confirmed Champ
According to PostgreSQL mail developers, you can exchange all "varchar(…)" by text with advantages only (if should work even faster, because PostgreSQL doesn't need to enforce size).

Reference: https://www.postgresql.org/docs/9.1/static/datatype-character.html

Tip: There is no performance difference among these three types, apart from increased storage space when using the blank-padded type, and a few extra CPU cycles to check the length when storing into a length-constrained column. While character(n) has performance advantages in some other database systems, there is no such advantage in PostgreSQL; in fact character(n) is usually the slowest of the three because of its additional storage costs. In most situations text or character varying should be used instead.

I'm running Activiti 5.20.0 with "text" instead "varchar", and have found no error so far.

Regards,

Edson Richter
1 REPLY 1

vasile_dirla
Star Contributor
Star Contributor
Thanks Edson,
As I read in the link you provided It seems it is a good idea to change it, but before changing it we should make sure there are no other side effects in the context of this application.

Thanks for the hint.