Re: storage space - Mailing list pgsql-general

From Tom Lane
Subject Re: storage space
Date
Msg-id 14503.1022811359@sss.pgh.pa.us
Whole thread Raw
In response to storage space  ("Don V. Soledad" <don.soledad@uratex.com.ph>)
List pgsql-general
"Don V. Soledad" <don.soledad@uratex.com.ph> writes:
> with the above structures, is it advisable to separate "notes" table from
> "quantities" to save storage space because an invoice to us may or may not
> have note/s?

I doubt it.  I'd recommend *one* notes column (allow it to contain
newlines if you want multiline notes, rather than hardwiring a maximum
number of lines).  Put it in the main table and let it be NULL (or
possibly an empty string) if there's no note.  It'll cost you an extra
4 bytes per row (or no extra space at all, if you use NULL and there's
already at least one other NULL in the row).  Avoiding having to join
the extra table seems well worth that.

One question is whether you intend to attach a note to each item of each
order, or only to a whole order.  The quantities table is not the place
if you want the latter.

            regards, tom lane

pgsql-general by date:

Previous
From: "Don V. Soledad"
Date:
Subject: storage space
Next
From: Curt Sampson
Date:
Subject: Re: Scaling with memory & disk planning