Re: partitioned table query question

Поиск
Список
Период
Сортировка
От Mike Rylander
Тема Re: partitioned table query question
Дата
Msg-id b918cf3d0712110520p5e8d28a4pd0c774c13d7c5e0f@mail.gmail.com
обсуждение исходный текст
Ответ на Re: partitioned table query question  (Erik Jones <erik@myemma.com>)
Ответы Re: partitioned table query question  (Erik Jones <erik@myemma.com>)
Список pgsql-general
On Dec 10, 2007 8:01 PM, Erik Jones <erik@myemma.com> wrote:
>
[snip]

> Again, though, is there some better way to go about implementing some
> kind of hash based partitioning in postgres besides this that would
> be more natural wrt queries?
>

Adding a column to hold the result of the %, perhaps updated by a
trigger so your app needn't change, and partitioning on that would be
the obvious way to get what you want today.  If you have a byte or two
of slack space in the tuple (by alignment), just use a "char" or an
INT2.  Assuming you don't affect fully aligned base tuple size, there
should be no table bloat, and no noticeable effect on speed.  As far
as being more natural WRT queries, well, you'd add to your where
clause

 bin = 34

instead of

  some_id % 100 = 34

The former seems to me to be more natural from the narrow perspective
of the SELECT statement.

--miker

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

Предыдущее
От: "Stanislav Raskin"
Дата:
Сообщение: Re: Understanding Aliases
Следующее
От: David Fetter
Дата:
Сообщение: Re: comparing rows