pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stoyan Genov <genov@digsys.bg>
To: pgsql-sql@postgreSQL.org
Cc: pgsql-novice@postgreSQL.org
Subject: Optimizing a query through its syntax and indices
Date: Wed, 03 Nov 1999 17:45:44 +0200
Message-ID: <199911031545.RAA13904@lorna.digsys.bg> (raw)


Hello,

I talk PostgreSQL 6.5.2 ...

Suppose we have some tables we join using some of their fields.
Suppose there are "restrictions" for the values of some (or all) of the tables'
fields of this kind: 
	tableM.fieldN [ NOT ] IN (constA,constB,constC),
	tableP.fieldQ [ NOT ] IN (constD,constE,constF),
	etc...
These restrictions can occur for the fields by which we join the tables, as well
as for fields of tables we do not use for joins.

Are there (can there be) general ( or not so general :-) ) rules for optimizing
the query ( and the performance and the speed ) through the particular order we
put the join statements in the WHERE clause, trough mixing/ordering the join
parts and the restrictions ( in the means defined above ) in the values of the
fields in the WHERE clause, through changing the syntax ( for example, using
UNION or EXCEPT clauses ), or through using one- or more-than-one-field
indices, or through doubling some of the restrictions if they refer to a
field we join by ( for example, "... WHERE tableM.fieldN = tableP.fieldQ and
tableM.fieldN in (constA,constB)" complemented by " and tableP.fieldQ in (constA
,constB)" ).

I hope I was clear enough for my question to be understood.

Any help will be appretiated.

Regards,
	Stoyan Genov



view thread (3+ messages)  latest in thread

Message-ID: <199911031545.RAA13904@lorna.digsys.bg>
Permalink:  ../199911031545.RAA13904@lorna.digsys.bg/
Also on:    postgresql.org/message-id/199911031545.RAA13904@lorna.digsys.bg

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: genov@digsys.bg, pgsql-novice@postgreSQL.org
  Subject: Re: Optimizing a query through its syntax and indices
  In-Reply-To: <199911031545.RAA13904@lorna.digsys.bg>
  References: <199911031545.RAA13904@lorna.digsys.bg>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox