Re: array vs bit fields for masking

From: Sergey Konoplev <sergey(dot)konoplev(at)postgresql-consulting(dot)com>
To: Chip Nowacek <chip(at)twostewards(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: array vs bit fields for masking
Date: 2012-06-18 06:16:32
Message-ID: CAL_0b1sFZQd+_HLqLvgRLsPer_gCA1mbenjmajk2+tiV-s8mKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On Sun, Jun 17, 2012 at 7:03 PM, Chip Nowacek <chip(at)twostewards(dot)com> wrote:
> configuration at the row level. My initial thinking was to have a bit field
> for each quality: version BIT(20), config(20). Each view would mask based on
> those fields. Then (multi-dimensional) arrays crossed my mind. Any
> performance / maintainability thoughts in using arrays vs bit fields?

If you intended to use this fields with partial indexes only
(http://www.postgresql.org/docs/9.1/static/indexes-partial.html) then
you will benefit in size. Otherwise I would advise to use arrays as
the are more feature rich and indexable (take a note of this
http://www.postgresql.org/docs/9.1/static/intarray.html).

Also look at the hstore
(http://www.postgresql.org/docs/9.1/static/hstore.html). You might
find it interesting to store the states in a more flexible way. Pay
attention to the index support in this case too.

--
Sergey Konoplev

a database architect, software developer at PostgreSQL-Consulting.com
http://www.postgresql-consulting.com

Jabber: gray(dot)ru(at)gmail(dot)com Skype: gray-hemp Phone: +79160686204

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Léa Massiot 2012-06-18 07:46:46 Re: Starting a cluster as a service
Previous Message Brian Herlihy 2012-06-18 00:11:37