Обсуждение: storage space

Поиск
Список
Период
Сортировка

storage space

От
"Don V. Soledad"
Дата:
good day!

i have the ff: table structures:

 Table "quantities"
 Attribute |     Type      | Modifier
-----------+---------------+----------
 invnbr    | varchar(12)   |
 ordernbr  | varchar(12)   |
 prodid    | varchar(30)   |
 invqty    | numeric(12,2) |
 uprice    | numeric(12,2) |

 Table "notes"
 Attribute |     Type      | Modifier
-----------+---------------+----------
 ordernbr  | varchar(12)   |
 line1  | varchar(60)   |
 line2  | varchar(60)   |
 line3  | varchar(60)   |

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?

thanks,
don

Re: storage space

От
Tom Lane
Дата:
"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