0

Does it make a query faster when a Postgresql column is set as character varying (50) instead of character varying (255) ?

DevonDahon
  • 7,460
  • 6
  • 69
  • 114
  • 1
    No, why would you assume it does? It only cuts down the storable data. – Bergi Nov 25 '20 at 13:13
  • 1
    What Bergi said. Additionally: the "magic number" 255 has no implied optimizations. Using 257 would have the same performance and storage costs (apart from allowing two more characters) –  Nov 25 '20 at 13:16
  • @Bergi Thanks for your answer. If I have a column where the max possible length for an entry is 50, I'd better set it to varchar(255) or is there a better choice which may improve performances ? – DevonDahon Nov 25 '20 at 13:26
  • @DevonDahon If you want a max possible length of 50, it needs to be `varchar(50)`. This has nothing to do with performance. – Bergi Nov 25 '20 at 13:28

0 Answers0