[Digikam-devel] extragear/graphics/digikam/libs/database

Andi Clemens andi.clemens at gmx.net
Thu May 28 19:58:02 BST 2009


I found only a quote now:

"So when you use LEFT JOIN, that forces a particular ordering  
of tables, and greatly restricts the query engines opportunities to  
optimize.  So you should avoid using LEFT JOIN if you don't really  
need it."

Seems that LEFT JOIN will not be optimized like the normal table connection by 
WHERE.

Andi

On Thursday 28 May 2009 20:54:24 Andi Clemens wrote:
> All I know is that LEFT JOIN seems to generate more internal SQL code,
> which might be a little bit slower.
> There is also some statement to see what SQL is doing internally, but I
> forgot it.
>
> I think I have a bookmark on this topic, I will attach it to this thread
> when I find it.
>
> I learned it this way, never used LEFT JOIN. But I don't think that it will
> make any difference in our case.
>
> Andi
>
> On Thursday 28 May 2009 20:47:08 Marcel Wiesweg wrote:
> > Thanks Andi. I am out of exercise with the database code ;-)
> > The query their is not old but just left over, I will remove it.
> > Btw I would have coded the statement like this:
> >
> > SELECT count() FROM Images
> > LEFT JOIN ImageInformation ON imageid == id
> > WHERE Images.status== 1  AND ImageInformation.format='JPG';
> >
> > Do you know pros and cons of either variant?
> >
> > Marcel
>
> _______________________________________________
> Digikam-devel mailing list
> Digikam-devel at kde.org
> https://mail.kde.org/mailman/listinfo/digikam-devel




More information about the Digikam-devel mailing list