Re: [Maypole] Maypole responding to requests very slowly (or, how to get just one associated record instead of getting the world)

From: Brian Glass (brian at glassbrian.com)
Date: Thu Sep 30 2004 - 15:19:37 BST


I was counting on the section in the Class::DBI manual that said the
Essential columns defaults to the All setting. I did try your suggestion
and set up which columns should be essential. Since these changes things
have gotten quite a bit speedier and the number of queries has dropped.

Your code line didn't work for some reason. I had to put each column in
by hand. Perhaps the All setting is not populated by default.

Regardless, I do agree with Simon that something needs to change in the
way Class::DBI::AsForm works in Maypole. It would make thinks
considerably snappier.

Thanks for your help.

Tony Bowden wrote:

>On Wed, Sep 29, 2004 at 12:48:16PM -0400, Brian Glass wrote:
>
>
>>What's happening is that Maypole is sucking down every row in the
>>account table to fill the $classmetadata->{cgi} structure.
>>I'm hoping the Maypole gods already have a solution for this problem... ;)
>>
>>
>
>as I said earlier, this is usually a sign that your Essential columns is
>too narrow.
>
>Class::DBI's Lazy Loading mechanism means that when you fetch data from
>the database for a record it only fetches the Essential columns. If you
>then ask for a column that it doesn't already have it goes back to the
>database for it.
>
>When you get back a number of rows from a search or a has_many or the
>like, it will do this all as one query. But if you're then calling a
>column accessor method on each in turn, for a column that isn't in
>Essential, it will go back to the database, in turn for each row, to
>fetch that extra information. Including the column in question in your
>Essential column group means it will only need that one original query.
>
>Try adding a
>
> Class::Name->columns(Essential => Class::Name->columns('All'));
>
>just to see if it makes a difference. If it does you should then choose
>the most sensible list of columns to include here, as you may not want
>to actually fetch back all the data for the entire table into memory in
>one go!
>
>Tony
>
>_______________________________________________
>maypole mailing list
>maypole at lists.netthink.co.uk
>http://lists.netthink.co.uk/listinfo/maypole
>
>
>

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT