pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: Advice for index design
Date: 12 Apr 2013 13:29:39 GMT
Message-ID: <kk9283$ctu$1@gonzo.reversiblemaps.ath.cx> (raw)
References: <CAAY=A78-djZ+T5TVmzN817tS31_E_RseWJvzJpAkDajprJDffg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

On 2013-04-10, JORGE MALDONADO <jorgemal1960@gmail.com> wrote:

> Our application offers a catalog of artists where a user can select a range
> of birthdays and/or sex. For example, a user can get an artists catalog for
> those  male artists who were born between May 1, 1970 and May 1, 1990
> ordered by birthday and, within each birthday date, ordered by name. I can
> think of defining one index for birthday, one index for name, and one index
> for sex.  Also, I can think of defining a compound index for birthday +
> name. Also there could be a compound index for sex + name. Another option
> could be a compound index for birthday + sex + name. There are many
> possible combinations. What is a good index design approach? 

the best approach depends on where you need the most improvement.

For your example query an undex on (sex,birthday,name) would be best.


-- 
⚂⚃ 100% natural



-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (4+ messages)

Message-ID: <kk9283$ctu$1@gonzo.reversiblemaps.ath.cx>
Permalink:  ../kk9283$ctu$1@gonzo.reversiblemaps.ath.cx/
Also on:    postgresql.org/message-id/kk9283$ctu$1@gonzo.reversiblemaps.ath.cx

 · 

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-sql@postgresql.org
  Cc: jasen@xnet.co.nz
  Subject: Re: Advice for index design
  In-Reply-To: <kk9283$ctu$1@gonzo.reversiblemaps.ath.cx>

* 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