Bacula-users

Re: [Bacula-users] Performance with MySQL queries since 3.0.0 (Dir inserting attributes hang)

2009-06-19 09:08:14
Subject: Re: [Bacula-users] Performance with MySQL queries since 3.0.0 (Dir inserting attributes hang)
From: "Mike Holden" <bacula AT mikeholden DOT org>
To: bacula-users AT lists.sourceforge DOT net
Date: Fri, 19 Jun 2009 13:43:16 +0100 (BST)
James Harper wrote:
> The subquery returns a very small result set (0 or 1, assuming you use
> DISTINCT) and so isn't too inefficient. It's when you say 'WHERE NOT
> EXISTS (SOME QUERY WITH LOTS OF RESULTS)' that you start to really bog
> down

True, but if the outer query contains a very large number of records, the
inner query is executed over and over and over and ...

This multiplies the small execution time by a large number.

Think of it like a WHILE loop that executes a block of code each time
round. The inner block of code might be quick, but if the loop goes round
several million times, the cumulative time becomes significant.

One general rule of thumb of SQL execution is that bulk processing is
almost always faster than processing records individually in a loop.
-- 
Mike Holden


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>