RE: [GENERAL] Optimal indicies - Mailing list pgsql-general

From Oleg Broytmann
Subject RE: [GENERAL] Optimal indicies
Date
Msg-id Pine.SOL2.3.96.SK.990418132247.7864A-100000@sun.med.ru
Whole thread Raw
In response to RE: [GENERAL] Optimal indicies  ("Jackson, DeJuan" <djackson@cpsgroup.com>)
List pgsql-general
Hi!

On Fri, 16 Apr 1999, Jackson, DeJuan wrote:
> try:
> EXPLAIN SELECT pos_id, rating
>  FROM pos_rating pr
>  WHERE date_i = current_date AND city_id = 2  AND
>  EXISTS (SELECT DISTINCT pos_id FROM positions p WHERE subsec_id = 1 AND
> status = 'A' AND pr.pos_id=p.pos_id)
> ORDER BY rating;

   This probably will help, thanks.

> Index date_i and city_id only.

   Why? How do I find (for any given query) what indices I do need?
Postgres (being just a program) definetely have a set of rules where to use
and where not to use indicies. Any way for us to know/understand these
rules? Any general rules?

>     -DEJ

Oleg.
----
    Oleg Broytmann     http://members.xoom.com/phd2/     phd2@earthling.net
           Programmers don't die, they just GOSUB without RETURN.


pgsql-general by date:

Previous
From: "Alexander F. Hartner"
Date:
Subject: JDBC + APPLET + AUTHENTICATION
Next
From: Dirk.Gerlach@t-online.de
Date:
Subject: ...