Skip site navigation (1) Skip section navigation (2)

JOIN vs. LEFT JOIN

From: "Nico Callewaert" <callewaert(dot)nico(at)telenet(dot)be>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: JOIN vs. LEFT JOIN
Date: 2009-01-28 10:43:24
Message-ID: DD54522572014D84A247B4662D5620AD@etsinformatics.local (view raw or flat)
Thread:
Lists: pgsql-novice
Hi !

I heard that it is always better to use a full JOIN rather than a LEFT JOIN, for performance reasons.  Is that correct ?
But it's barely possible to use full JOINS all the time, since most of the lookup fields are not required.
Example : in the customer table, the customer type is a looup field to a customer_type table.  But that is not required to post the record.  So I was thinking to create a record in the customer_type table with ID = -1.  And in case the customer type is NULL, to assign it the value -1.  That way, it will be always possible to do a full JOIN.  I was wondering if that is good practice or rather nonsense ?

Many thanks in advance,
Nico

Responses

pgsql-novice by date

Next:From: Andreas WenkDate: 2009-01-28 11:22:37
Subject: Re: JOIN vs. LEFT JOIN
Previous:From: Mike EllsworthDate: 2009-01-27 23:04:32
Subject: Re: using to_number() in a select query with ranges

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group