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-21 08:54:19
Message-ID: Pine.SOL2.3.96.SK.990421125028.22429A-100000@sun.med.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

On Tue, 20 Apr 1999, Jackson, DeJuan wrote:
> The reason I chose those tow columns is because they are the only one that
> will be seen in that where clause.
> So position should be indexed on subsec_id, status, and pos_id.

Sounds reasonable.

> My general rule of thumb is to stay away from OR clause in PostgreSQL (which
> is what an IN or NOT IN translate to), and index the columns that are

I heared an advice (from Vadim, who implemented this) that IN is not
very effective. EXIST and correlated subqueries are much better.

> definitely included in most where clauses on that table.

Should these indicies be created as compound index (CREATE INDEX myindex
ON TABLE mytable (field1, field2)) or separated
(
CREATE INDEX myindex1 ON TABLE mytable (field1)
CREATE INDEX myindex2 ON TABLE mytable (field2)
)
?

> -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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Remigiusz Sokolowski 1999-04-21 10:28:28 RE: [GENERAL] Optimal indicies
Previous Message listuser 1999-04-21 06:00:20 XML objects in Postgres