RE: [GENERAL] Optimal indicies

From: Oleg Broytmann <phd(at)sun(dot)med(dot)ru>
To: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgreSQL(dot)org>
Subject: RE: [GENERAL] Optimal indicies
Date: 1999-04-18 09:25:47
Message-ID: Pine.SOL2.3.96.SK.990418132247.7864A-100000@sun.med.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)earthling(dot)net
Programmers don't die, they just GOSUB without RETURN.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dirk.Gerlach 1999-04-18 17:55:28
Previous Message Alexander F. Hartner 1999-04-17 21:42:45 JDBC + APPLET + AUTHENTICATION