pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Orion Henry <orion@trustcommerce.com>
To: pgsql-performance@postgresql.org
Subject: help with dual indexing
Date: 23 Jan 2004 10:58:31 -0800
Message-ID: <1074884311.10503.133.camel@orthanc> (raw)

I've got a table with about 10 million events in it.

Each has a user_id (about 1000 users) and a event_time timestamp
covering a 4 year period with about 50% of the events being in the last
year.  Some users have only dozens of events.  A few have hundreds of
thousands.

The queries usually are in the form of, where "user_id = something and
event_time between something and something".

Half of my queries index off of the user_id and half index off the
event_time.  I was thinking this would be a perfect opportunity to use a
dual index of (user_id,event_time) but I'm confused as to weather this
will help considering the size of this index given that there very few
tuples that have the exact same timestamp as another and I'm not sure
which order to put the user_id/event_time as I don't know what is meant
when people on this list ask which is more selective.

Also, would it make sense for me to raise my ANALYZE value and how would
I go about doing this?

Thanks for the help.


-- 
Orion Henry <orion@trustcommerce.com>

Attachments:

  signature.asc (application/pgp-signature, 188B) download

view thread (3+ messages)  latest in thread

Message-ID: <1074884311.10503.133.camel@orthanc>
Permalink:  ../1074884311.10503.133.camel@orthanc/
Also on:    postgresql.org/message-id/1074884311.10503.133.camel@orthanc

 · 

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: orion@trustcommerce.com
  Subject: Re: help with dual indexing
  In-Reply-To: <1074884311.10503.133.camel@orthanc>

* 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