Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL primary key length limit

What is the limit of the length of primary key column? I'm going to use varchar as primary key. I've found no info, how long it can be, since PostgreSQL does not require to specify varchar limit when used as primary key?

like image 289
FolksLord Avatar asked Dec 27 '10 14:12

FolksLord


1 Answers

The maximum length for a value in a B-tree index, which includes primary keys, is one third of the size of a buffer page, by default floor(8192/3) = 2730 bytes.

like image 51
Peter Eisentraut Avatar answered Oct 14 '22 18:10

Peter Eisentraut