Re: some optimization?

From: dima <_pppp(at)mail(dot)ru>
To: Ciprian Popovici <ciprian(dot)popovici(at)integrare(dot)ro>
Cc: postgres <pgsql-general(at)postgresql(dot)org>
Subject: Re: some optimization?
Date: 2002-09-19 11:20:43
Message-ID: 3D89B30B.6050003@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ciprian Popovici wrote:
> select distinct on (code) id,code,active from objects \
> where version<=2 and (process=17 or process=0) \
> group by id,code,active,version \
> order by code asc,active desc,version desc
>
> I'm a bit green with Postgres. Is this query performant enough? Are
> there things I can do to make it better (indexing, some other method?)
> I have 'id' as the primary key and unique(code,version,active).
the common optimization step should surely be indexing on all the fields
used in "where" constraint. everything else depends on the various
additional parametres.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Christian Imbeault 2002-09-19 11:20:50 Re: IN vs EXIIST
Previous Message Jochem van Dieten 2002-09-19 11:18:11 Re: IN vs EXIIST