RE: [GENERAL] Optimal indicies
Oleg Broytmann <phd@sun.med.ru>
From: Oleg Broytmann <phd@sun.med.ru>
To: "Jackson, DeJuan" <djackson@cpsgroup.com>
Cc: PostgreSQL <pgsql-general@postgreSQL.org>
Date: 1999-04-18T09:25:47Z
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@earthling.net
Programmers don't die, they just GOSUB without RETURN.