pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: T E Schmitz <mailreg@numerixtechnology.de>
To: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: indexing for left join
Date: Thu, 19 Jan 2006 16:42:18 +0000
Message-ID: <43CFC16A.5090604@numerixtechnology.de> (raw)
In-Reply-To: <200601191703.51554.milorad.poluga@cores.co.yu>
References: <43CFB325.9060306@numerixtechnology.de>
	<200601191703.51554.milorad.poluga@cores.co.yu>

Milorad Poluga wrote:
>  Try to execute this modification of your query : 
> 
>  SELECT ITEM.ITEM_PK FROM ITEM
>  LEFT JOIN SERIAL_NO 
> 	ON ( SERIAL_NO.ITEM_FK = ITEM.ITEM_PK
>                        AND SERIAL_NO.NO ='WX1234' )
>  GROUP BY ITEM.ITEM_PK
> 

>>SELECT ITEM.ITEM_PK FROM ITEM
>>LEFT JOIN SERIAL_NO ON SERIAL_NO.ITEM_FK = ITEM.ITEM_PK
>>WHERE SERIAL_NO.NO ='WX1234'
>>GROUP BY ITEM.ITEM_PK

For my small test DB both queries result in the same strategy.
The query will be generated by an object relational interface depending
on the user's search criteria. It will definitely be of the form I
specified.

I wanted to make sure that I have chosen the indices correctly. I am
presuming, if the tables are big, that the index on SERIAL_NO.NO will be
used for the WHERE clause and the one on SERIAL_NO.ITEM_FK for the join.

-- 


Regards,

Tarlika Elisabeth Schmitz




view thread (6+ messages)  latest in thread

Message-ID: <43CFC16A.5090604@numerixtechnology.de>
Permalink:  ../43CFC16A.5090604@numerixtechnology.de/
Also on:    postgresql.org/message-id/43CFC16A.5090604@numerixtechnology.de

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mailreg@numerixtechnology.de
  Subject: Re: indexing for left join
  In-Reply-To: <43CFC16A.5090604@numerixtechnology.de>

* 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