[Catalyst] Pager and Cache

Mitch Jackson perimus at gmail.com
Mon May 19 20:19:07 BST 2008


Emmanuel,

In most cases, the pager functionality only selects the table rows
from the database you intend to display.  If, for example, you ask for
page 3 of a record set with 10 rows per page, LIMIT 20,10 will be
added to the end of a MySQL query, asking the database for 10 rows
starting at row number 20.

For many reasons, you want to let your data live in the database where
it belongs.  Trying to hold it all in memory or cache in your
application is  a Very Bad Idea, and defeats the purpose of your
database.

If you are having performance issues selecting from your database,
perhaps your table is not properly indexed?

To easily see what queries are being executed while you use your app,
start your test server like this:
$ DBIC_TRACE=1 script/myapp_server.pl

Kind Regards,

/Mitchell K. Jackson

On Mon, May 19, 2008 at 10:57 AM, Emmanuel Quevillon <tuco at pasteur.fr> wrote:
> Hi,
>
> I don't know if this question have been already sent or not but I am
> wondering if it is possible to sort cache a pager into the catalyst
> application to be able to quickly get results from a query that would have
> been cached.
> More explanation :
>
> I read in Jrock's book that a pager is quite easy to implement using
> $rs->page() and a page parameter in the query url to display results.
> However, this example (and method) obligate to redo the query search each
> time the user ask for the next, previous or last page. In the case the
> request takes a very long time, navigate through results start to be a pain.
> So is there a solution or would it be reasonable to think of caching the
> pager in the catalyst application to directly access each pages without
> requesting the database for the same query?
>
> Sorry if my question looks stupid...
>
> thanks anyway
>
> Regards
> --
> -------------------------
> Emmanuel Quevillon
> Biological Software and Databases Group
> Institut Pasteur
> +33 1 44 38 95 98
> tuco at_ pasteur dot fr
> -------------------------
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



More information about the Catalyst mailing list