Slow database performance when you run a query on a large table sounds like a lack of an index on that table.
What database engine are you using? (SQLite, MySQL, Postgres etc?)
Are there indexes on the relevant columns in your tables? You can specify indexes in your DBIC table definition with __PACKAGE__->add_index(name => 'idx_name', fields => ['name']); See: The DBIx::Class Cookbook.
Have you tried running the query by hand using raw SQL to see what performance you get? (You can get DBIx::Class to emit each SQL call it makes by setting the DBIC_TRACE environment variable to a true value. See: DBIx::Class::Storage. It might also be worth using the SQL EXPLAIN command on your keyword to understand a bit more how the database treats your query, and if there is anything expensive in there.
You say that you have a many to many relationship bridge. When is the link table populated? If by some mechanism it does not exist at start-up, but is created on the fly on first use, then that would explain the slow performance when you first use it, though I have never come across a system where that creates link tables automatically.
In reply to Re: DBIx startup slow
by chrestomanci
in thread DBIx startup slow
by anjalis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |