pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: H.J. Sanders <hjs@rmax.nl>
To: pgsql-performance@postgresql.org
Subject: date - range
Date: Fri, 1 Apr 2005 12:05:44 +0200
Message-ID: <KIEBKBGIGGNDKKJJNKCFKEPLEEAA.hjs@rmax.nl> (raw)


Anybody a solution for the next problem:

people can subscribe to a service for 1 or more days (upto a max. of 365).

So in the database is stored: first_date and last_date

To select which people are subscribed for a certain date (e.g. today) we use
a select like

select   ....... where first_date <= today and last_date >= today

Whatever index we create system always does a sequential scan (which I can
understand).

Has someone a smarter solution?

All suggestions will be welcomed.





view thread (6+ messages)  latest in thread

Message-ID: <KIEBKBGIGGNDKKJJNKCFKEPLEEAA.hjs@rmax.nl>
Permalink:  ../KIEBKBGIGGNDKKJJNKCFKEPLEEAA.hjs@rmax.nl/
Also on:    postgresql.org/message-id/KIEBKBGIGGNDKKJJNKCFKEPLEEAA.hjs@rmax.nl

 · 

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: hjs@rmax.nl
  Subject: Re: date - range
  In-Reply-To: <KIEBKBGIGGNDKKJJNKCFKEPLEEAA.hjs@rmax.nl>

* 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