Re: Performance Query

[prev] [thread] [next] [Date index for 2004/09/07]

From: William McKee
Subject: Re: Performance Query
Date: 14:15 on 07 Sep 2004
On Tue, Sep 07, 2004 at 08:30:15AM +0100, tom@xxxxxxxx.xxx wrote:
> Assuming this has been 'modelled' with the use of the "has_a"
> Class::DBI methods (because that is the best way to do it with
> Class::DBI?) on the User class - how many hits are there actually to
> the database?

Although Tony did not address this question, I think you are correct.


> The first SQL is 1 query with 1 overhead retriving X rows and the 2nd
> loop is 1+X*3 queries retrieving X+1 rows. My worries are that if I
> start retrieve a few thousand rows, instead of 1 query, I have 3000+
> queries to the database. Make this a web site with a few concurrent
> visitors and suddenly I am hitting the database with 10,000 queries?
> To me that is a performance issue.

I'd agree with Tony to look at why you are retrieving 1000 rows for a
request. If you decide that it's vitally important to retrieve all 1000
and a code profile has shown that CDBI is where your slowdown is really
at, then you can use set_sql to create a custom sql statement that
returns exactly what you need. Check the docs and the wiki for examples
(particularly the recipe about joins).


HTH,
William

        -- 
        Knowmad Services Inc.
http://www.knowmad.com

Performance Query
tom 13:25 on 06 Sep 2004

Re: Performance Query
William McKee 21:23 on 06 Sep 2004

Re: Re: Performance Query
tom 07:30 on 07 Sep 2004

Re: Re: Performance Query
Tony Bowden 07:45 on 07 Sep 2004

Re: Performance Query
William McKee 14:15 on 07 Sep 2004

Re: Re: Performance Query
Perrin Harkins 21:10 on 07 Sep 2004

Re: Performance Query
Carl Johnstone 08:57 on 07 Sep 2004

Re: Performance Query
Tony Bowden 09:09 on 07 Sep 2004

RE: Performance Query
Carl Johnstone 09:11 on 07 Sep 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52