[Dbix-class] Index
Will Hawes
wdhawes at gmail.com
Fri Feb 8 19:49:34 GMT 2008
On 08/02/2008, Will Smith <willbelair at yahoo.com> wrote:
>
> How do I index the search that returns more than a thousand records with
> several parameters? My server runs pretty slow on a search like that.
> In the DBIx::Class::ResultSet, I found there is way to do indexing, but
> it's not very clear, so, would someone please help me out. I'm using MySQL
> database. The base class of the table is:
> ----------------------------------------------
> package myDB::HTMLLinks;
>
> use base qw/DBIx::Class/;
>
> # Load required DBIC stuff
> __PACKAGE__->load_components(qw/PK::Auto Core/);
> # Set the table name
> __PACKAGE__->table('htmllinks');
> # Set columns in table
> __PACKAGE__->add_columns(qw/
> id
> link
> activel
> /);
> # Set the primary key for the table
> __PACKAGE__->set_primary_key(qw/id/);
>
> --------------------------------
> What do I need to add in this class, and in the controller that calls the
> search?
If you're talking about
http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod#Adding_Indexes_And_Functions_To_Your_SQL,
I think that refers to generating a schema for deployment, not
searching itself.
Maybe you need to look at paging, so you can return smaller numbers of
rows at a time?
More information about the DBIx-Class
mailing list