pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steven Lembark <lembark@wrkhors.com>
To: pgsql-general@lists.postgresql.org
Cc: lembark@wrkhors.com
Subject: Re: PG Schema to be used as log and monitoring store
Date: Sat, 9 Dec 2017 16:01:47 -0600
Message-ID: <20171209160147.36322c55@wrkhors.com> (raw)
In-Reply-To: <CAFcOn2-haFL3N6KFzK-zjJHTWnNSE05+iTWy1ahJFFzWbwn4Gg@mail.gmail.com>
References: <CAFcOn2-haFL3N6KFzK-zjJHTWnNSE05+iTWy1ahJFFzWbwn4Gg@mail.gmail.com>

On Sat, 9 Dec 2017 20:22:02 +0100
Stefan Keller <sfkeller@gmail.com> wrote:

>   create table m1 (
>     id bigint,
>     created timestamp,
>     b20 bit(20) default b'00000000000000000000',
>     farr20 float8[20]
>   );

In general this is a bad idea *unless* you have benchmarked the 
database and found that the amount of space saved really does make
some difference. Using the packed format makes most SQL a lot harder
to write and makes indexing impossible (or at least messy and rather
error prone). This also makes adding add'l fields harder.

If you were really intent on doing this I'd add a few million recods
with both formats on a database tuned to handle the load and see if 
the packed bits really do make a difference. My guess is that you
won't see all that much difference in storage and the query speed
with effective indexing is going to be decent.

Using this database might be a lot simpler with a few that 
breaks the sub-fields out, or which has indexes on the sub
-fields within the packed data. 


-- 
Steven Lembark                                       1505 National Ave
Workhorse Computing                                 Rockford, IL 61103
lembark@wrkhors.com                                    +1 888 359 3508




view thread (7+ messages)  latest in thread

Message-ID: <20171209160147.36322c55@wrkhors.com>
Permalink:  ../20171209160147.36322c55@wrkhors.com/
Also on:    postgresql.org/message-id/20171209160147.36322c55@wrkhors.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: lembark@wrkhors.com
  Subject: Re: PG Schema to be used as log and monitoring store
  In-Reply-To: <20171209160147.36322c55@wrkhors.com>
  References: <CAFcOn2-haFL3N6KFzK-zjJHTWnNSE05+iTWy1ahJFFzWbwn4Gg@mail.gmail.com> <20171209160147.36322c55@wrkhors.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox