Fix some now-obsolete comments about the space used by various data
authorTom Lane
Fri, 6 Apr 2007 19:22:38 +0000 (19:22 +0000)
committerTom Lane
Fri, 6 Apr 2007 19:22:38 +0000 (19:22 +0000)
types.

doc/src/sgml/array.sgml
doc/src/sgml/datatype.sgml

index 74e9e083f700a4eaa8b70c377bd14c53da14fd4b..ec59d8e6a884f794cca3ce450b6e4c00de8d80f6 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
 
  Arrays
@@ -10,8 +10,8 @@
  
   PostgreSQL allows columns of a table to be
   defined as variable-length multidimensional arrays. Arrays of any
-  built-in or user-defined base type can be created.  (Arrays of
-  composite types or domains are not yet supported, however.)
+  built-in or user-defined base type or enum type can be created.
+  (Arrays of composite types or domains are not yet supported, however.)
  
 
  
index fc5be3a1061f9a2ebd9637ffaea08608beacfaf6..8bcaf7176075a6af5caa43db8be5183adf7d4c98 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
  
   Data Types
@@ -516,7 +516,7 @@ NUMERIC
      type is more akin to varchar(n)
      than to char(n).)  The actual storage
      requirement is two bytes for each group of four decimal digits,
-     plus eight bytes overhead.
+     plus five to eight bytes overhead.
     
 
     
@@ -842,9 +842,9 @@ ALTER SEQUENCE tablename_
       
        
         money
-        4 bytes
+        8 bytes
         currency amount
-        -21474836.48 to +21474836.47
+        -92233720368547758.08 to +92233720368547758.07
        
       
      
@@ -975,12 +975,13 @@ ALTER SEQUENCE tablename_
    
 
    
-    The storage requirement for data of these types is 4 bytes plus the
-    actual string, and in case of character plus the
-    padding. Long strings are compressed by the system automatically, so
-    the physical requirement on disk might be less. Long values are also
-    stored in background tables so they do not interfere with rapid
-    access to the shorter column values. In any case, the longest
+    The storage requirement for a short string (up to 126 bytes) is 1 byte
+    plus the actual string, which includes the space padding in the case of
+    character.  Longer strings have 4 bytes overhead instead
+    of 1.  Long strings are compressed by the system automatically, so
+    the physical requirement on disk might be less. Very long values are also
+    stored in background tables so that they do not interfere with rapid
+    access to shorter column values. In any case, the longest
     possible character string that can be stored is about 1 GB. (The
     maximum value that will be allowed for n in the data
     type declaration is less than that. It wouldn't be very useful to
@@ -994,8 +995,10 @@ ALTER SEQUENCE tablename_
    
     
      There are no performance differences between these three types,
-     apart from the increased storage size when using the blank-padded
-     type.  While character(n) has performance
+     apart from increased storage size when using the blank-padded
+     type, and a few extra cycles to check the length when storing into
+     a length-constrained column.  While
+     character(n) has performance
      advantages in some other database systems, it has no such advantages in
      PostgreSQL.  In most situations
      text or character varying should be used
@@ -1080,7 +1083,7 @@ SELECT b, char_length(b) FROM test2;
        
         "char"
         1 byte
-        single-character internal type
+        single-byte internal type
        
        
         name
@@ -1122,7 +1125,7 @@ SELECT b, char_length(b) FROM test2;
      
       
        bytea
-       4 bytes plus the actual binary string
+       1 or 4 bytes plus the actual binary string
        variable-length binary string
       
      
@@ -2879,13 +2882,13 @@ SELECT person.name, holidays.num_weeks FROM person, holidays
 
        
         cidr
-        12 or 24 bytes
+        7 or 19 bytes
         IPv4 and IPv6 networks
        
 
        
         inet
-        12 or 24 bytes
+        7 or 19 bytes
         IPv4 and IPv6 hosts and networks
        
 
@@ -3188,6 +3191,12 @@ SELECT * FROM test;
 
    
 
+   
+    A bit string value requires 1 byte for each group of 8 bits, plus
+    5 or 8 bytes overhead depending on the length of the string
+    (but long values may be compressed or moved out-of-line, as explained
+    in  for character strings).
+