Re: limit table to one row

Поиск
Список
Период
Сортировка
От Brandon Metcalf
Тема Re: limit table to one row
Дата
Msg-id Pine.LNX.4.58L.0906091042420.11099@cedar.geronimoalloys.com
обсуждение исходный текст
Ответ на Re: limit table to one row  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Список pgsql-general
g == gryzman@gmail.com writes:

 g> If you want to store period of time, why store it as varchar ?

 g> just store two rows
 g> create table foo(
 g>   n varchar,
 g>   val date
 g> );

 g> and store two rows:
 g> "start", now(),
 g> "end", now()+'something '::interval

 g> Wouldn't that do, or is there something I misunderstand ?

Sure, that would work, but I'm having to retrofit this table to an
existing system.  Much of the system I'm redesigning, but this piece
isn't too terribly important right now.

 g> The approach with vertical structure, is used when people want to
 g> store some particular state, say - kind of like structure in C, but in
 g> SQL, and they create table for it with all the columns, etc, and have
 g> to limit it to one row.

 g> On the other hand, you could also use unique index on (1) approach
 g> (say if you need more variety of types).

Got it.

--
Brandon

В списке pgsql-general по дате отправления:

Предыдущее
От: Grzegorz Jaśkiewicz
Дата:
Сообщение: Re: limit table to one row
Следующее
От: Dimitri Fontaine
Дата:
Сообщение: Re: postgres getting slow under heavy load though autivacuum is enabled