Re: indexing for left join - Mailing list pgsql-sql

From T E Schmitz
Subject Re: indexing for left join
Date
Msg-id 43CFC16A.5090604@numerixtechnology.de
Whole thread Raw
In response to indexing for left join  (T E Schmitz <mailreg@numerixtechnology.de>)
List pgsql-sql
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



pgsql-sql by date:

Previous
From: "Leif B. Kristensen"
Date:
Subject: Re: Error calling self-made plpgsql function "function XYZ(bigint) does not exist"
Next
From: T E Schmitz
Date:
Subject: Re: indexing for left join