mjgardner / dbcritic

Critique a database schema for best practices
http://mjgardner.github.io/dbcritic
7 stars 2 forks source link

slow queries #3

Closed mjgardner closed 13 years ago

mjgardner commented 13 years ago

From Josh at Shutterstock:

I'm seeing a few really slow queries being generated from the code. They look like this:

SELECT * FROM TABLENAME WHERE ( 1 = 0 )

mjgardner commented 13 years ago

I've traced that particular query to &DBIx::Class::Schema::Loader::DBI::_table_columns, which is used to discover table column names. I assume that most of the other slow queries will have a similar rationale.

One way to speed things up is to pass a pre-existing DBIx::Class::Schema instead of a DSN and login information. Right now the only way to do that is in code; I'll work on an update to pass a class name from the command line.

mjgardner commented 13 years ago

As of 7aa8bf7 you can now use the --class_name option (or constructor parameter) to point to an existing DBIx::Class::Schema.