From: Mike Castle <dalgoda@ix.netcom.com>
To: Postgres SQL list <pgsql-sql@postgresql.org>
Subject: Re: Using INDEX on date/time values // Re: how to select a time frame on timestamp rows.
Date: Sun, 14 Jan 2001 17:51:33 -0800
Message-ID: <20010114175133.C3604@thune.yy.com> (raw)
In-Reply-To: <3A612100.D68ABDE8@merz-akademie.de>
References: <Pine.LNX.4.30.0101140208531.965-100000@peter.localdomain>
<3A612100.D68ABDE8@merz-akademie.de>
On Sun, Jan 14, 2001 at 04:46:08AM +0100, Alvar Freude wrote:
> Peter Eisentraut schrieb:
> >
> > > today i was trying to perform a query on a database using a time stamp
> > > field, i need to get all records which belong to year 2000, month 11,
> [...]
> > select user_name from tbacct where extract(month from acct_timestamp) = 11 ...
>
> is there any way of using an index for selecting some rows, e.g.
> selecting all data from one month?
What about select blah from foo where month >= 2000-11-01 and month < 2000-12-01
Fix up as appropriate.
mrc
--
Mike Castle Life is like a clock: You can work constantly
dalgoda@ix.netcom.com and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc
We are all of us living in the shadow of Manhattan. -- Watchmen
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-sql@postgresql.org
Cc: dalgoda@ix.netcom.com
Subject: Re: Using INDEX on date/time values // Re: how to select a time frame on timestamp rows.
In-Reply-To: <20010114175133.C3604@thune.yy.com>
References: <Pine.LNX.4.30.0101140208531.965-100000@peter.localdomain> <3A612100.D68ABDE8@merz-akademie.de> <20010114175133.C3604@thune.yy.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