From: Samuel Gendler <sgendler@ideasculptor.com>
To: Anish Kejariwal <anishkej@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: josh@agliodbs.com
Cc: pgsql-performance@postgresql.org
Subject: Re: Expected performance of querying 5k records from 4 million records?
Date: Mon, 18 Jun 2012 09:49:39 -0700
Message-ID: <CAEV0TzBC_MVO_D65dWMoRXFSMCnFfFa7ZDikcom9aEKFXsjL0A@mail.gmail.com> (raw)
In-Reply-To: <CAOpcnr9MOa_CbB7pLOOry_710F4F27zeXjXqSYbf7kKvx5owwg@mail.gmail.com>
References: <CAOpcnr8S2hmV1z-=ZF1k+t+uWWyw82nUbwhpQmdf=8R_Kpv78g@mail.gmail.com>
<CAMkU=1zn+Z9iw96nEqJjqSzysv53DT8Y0Kba2GTw9a9qHtEC6w@mail.gmail.com>
<CAOpcnr9MOa_CbB7pLOOry_710F4F27zeXjXqSYbf7kKvx5owwg@mail.gmail.com>
On Mon, Jun 18, 2012 at 9:39 AM, Anish Kejariwal <anishkej@gmail.com> wrote:
>
> So, it looks like clustering the index appropriately fixes things! Also,
> I'll recreate the index switching the order to (dataset_id, stat_id,data_id)
>
> Just keep in mind that clustering is a one-time operation. Inserts and
updates will change the order of records in the table, so you'll need to
re-cluster periodically to keep performance high if there are a lot of
inserts and updates into the tables. I didn't re-read the thread, but I
seem recall a partitioned table, so assuming you are partitioning in a
manner which keeps the number of partitions that are actively being
inserted/updated on to a minimum, you only need to cluster the active
partitions, which isn't usually terribly painful. Also, if you are bulk
loading data (and not creating random spaces in the table by deleting and
updating), you can potentially order the data on the way into the table to
avoid the need to cluster repeatedly.
--sam
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-performance@postgresql.org
Cc: sgendler@ideasculptor.com, anishkej@gmail.com, jeff.janes@gmail.com, josh@agliodbs.com
Subject: Re: Expected performance of querying 5k records from 4 million records?
In-Reply-To: <CAEV0TzBC_MVO_D65dWMoRXFSMCnFfFa7ZDikcom9aEKFXsjL0A@mail.gmail.com>
References: <CAOpcnr8S2hmV1z-=ZF1k+t+uWWyw82nUbwhpQmdf=8R_Kpv78g@mail.gmail.com> <CAMkU=1zn+Z9iw96nEqJjqSzysv53DT8Y0Kba2GTw9a9qHtEC6w@mail.gmail.com> <CAOpcnr9MOa_CbB7pLOOry_710F4F27zeXjXqSYbf7kKvx5owwg@mail.gmail.com> <CAEV0TzBC_MVO_D65dWMoRXFSMCnFfFa7ZDikcom9aEKFXsjL0A@mail.gmail.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