einhverfr has asked for the wisdom of the Perl Monks concerning the following question:
This is not a normal situation but I am working with a partitioned table and would like to route selects against the parent table to the partitions directly (in order to avoid the db planner requiring access to the other tables for constraint exclusion reasons.
Ideally primary key would have a field in a multi-column pkey, something like "partion_id" and the table name would be something like "mytable_" . $self->partition_id.
What is the best way to accomplish this?
Edit: Selecting on the main table works from an application perspective but it has unpleasant effects on database administration tasks (ones which lock any underlying tables block *all* queries on the parent table) and one can't just use a view because the view doesn't get to decide without doing exactly what the current query is doing (a union through all with constraint exclusion). Subclassing isn't an option because this is a component of a complex system and subclassing for every partition will get ridiculous quickly. So I am looking to see if there is a way I can tie the table to the object instead of the package.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dynamic table names and DBIx::Class
by erix (Prior) on Jun 25, 2015 at 21:41 UTC | |
by einhverfr (Friar) on Jun 26, 2015 at 06:45 UTC | |
|
Re: Dynamic table names and DBIx::Class
by GotToBTru (Prior) on Jun 25, 2015 at 20:54 UTC | |
by einhverfr (Friar) on Jun 26, 2015 at 06:48 UTC |