Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

In the official documentation (http://www.postgresql.org/docs/9.1/static/datatype-character.html), it states text field is variable unlimited length.

I wonder what is the default size of this field (or minimum size of the field)?

share|improve this question
3  
No such things. –  Milen A. Radev Nov 1 '13 at 7:45

2 Answers 2

The default minimum size of a text column (representing a NULL value) depends on the rest of the row. In most cases it is absolutely free, if the NULL bitmask can swallow another column.
Details in this related answer on SO.

More about calculating the effective row size:
Configuring PostgreSQL for read performance

share|improve this answer

By default such a column will be NULL (essentially zero-length, though remember there is a difference between a zero-length string and a NULL) unless you specify a default constraint in the table definition, and it will grow as needed when you insert data.

If you are asking how much space it takes on disk then this will never be completely zero of course, but there are few times when the minimum size is truly significant (if you are storing millions of rows with very short or mostly NULL text fields it might be). Assuming postgres' storage engine uses a structure not dissimilar to MSSQL then if they are stored off-page (small values are likely to be stored in-page) there will be a page reference (8 bytes?) to find the start of the string - so you might consider that, plus space in NULL bitmap and any other flags such as in-or-off-page, as the minimum footprint of such a type.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.