pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Kirkwood <mark.kirkwood@catalyst.net.nz>
To: pgsql-performance@postgresql.org
Subject: Re: Memory usage - indexes
Date: Wed, 29 Sep 2010 21:03:08 +1300
Message-ID: <4CA2F2BC.8090307@catalyst.net.nz> (raw)
In-Reply-To: <AANLkTim_Ba7_Am6aoR52tZi_gU5QR8QB99e4m_BuwvGX@mail.gmail.com>
References: <AANLkTimd0Y7KhnwkSXz4FYjsxC8ocDeRRH=PXvU1a3vv@mail.gmail.com>
	<AANLkTim_Ba7_Am6aoR52tZi_gU5QR8QB99e4m_BuwvGX@mail.gmail.com>

On 29/09/10 19:41, Tobias Brox wrote:
> I just got this crazy, stupid or maybe genius idea :-)
>
>
> Now, my idea is to drop that fat index and replace it with conditional
> indexes for a dozen of heavy users - like those:
>
>    acc_trans(trans_type, created) where customer_id=224885;
>    acc_trans(trans_type, created) where customer_id=643112;
>    acc_trans(trans_type, created) where customer_id=15;
>
> or maybe like this:
>
>    acc_trans(customer_id, trans_type, created) where customer_id in ( ... );
>
> Any comments?
>
> My sysadmin is worried that it would be a too big hit on performance
> when doing inserts.  It may also cause more overhead when planning the
> queries.  Is that significant?  Is this idea genius or stupid or just
> somewhere in between?
>
>    

Yeah, I think the idea of trying to have a few smaller indexes for the 
'hot' customers is a good idea. However I am wondering if just using 
single column indexes and seeing if the bitmap scan/merge of smaller 
indexes is actually more efficient is worth testing - i.e:

acc_trans(trans_type);
acc_trans(created);
acc_trans(customer_id);

It may mean that you have to to scrutinize your effective_cache_size and 
work_mem parameters, but could possibly be simpler and more flexible.

regards

Mark






view thread (24+ messages)  latest in thread

Message-ID: <4CA2F2BC.8090307@catalyst.net.nz>
Permalink:  ../4CA2F2BC.8090307@catalyst.net.nz/
Also on:    postgresql.org/message-id/4CA2F2BC.8090307@catalyst.net.nz

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mark.kirkwood@catalyst.net.nz
  Subject: Re: Memory usage - indexes
  In-Reply-To: <4CA2F2BC.8090307@catalyst.net.nz>

* 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