pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Claus Heiko Niesen <cniesen@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Can this query be optimized?
Date: Thu, 08 Nov 2001 09:30:05 -0500
Message-ID: <16760.1005229805@sss.pgh.pa.us> (raw)
In-Reply-To: <5.1.0.14.2.20011107144418.00a83b68@pop.gmx.net>
References: <5.1.0.14.2.20011107144418.00a83b68@pop.gmx.net>

Claus Heiko Niesen <cniesen@gmx.net> writes:
> I'm stuck optimizing the following query:
> select distinct extract(year from date) as year, extract(month from date) 
> as month, date from week_pics order by date desc;

Perhaps it would work to forget the "distinct" and instead GROUP BY
date.

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <16760.1005229805@sss.pgh.pa.us>
Permalink:  ../16760.1005229805@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16760.1005229805@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, cniesen@gmx.net
  Subject: Re: Can this query be optimized?
  In-Reply-To: <16760.1005229805@sss.pgh.pa.us>

* 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