Jump to content

Can ActiveRecords handle multi-column $databaseColumnId?


KT Walrus
Go to solution Solved by KT Walrus,

Recommended Posts

I have an ActiveRecord table with a multi-column primary key. The ActiveRecord class has $databaseColumnId that appears to require a single Id key. My table doesn't need a single column key as it only adds another secondary index for the table (that wastes disk space, memory, and processor time).

Is my only option to set $databaseColumnId to an auto-incremented column and define a secondary index for this column? This is a waste (to have an extra secondary index) when the ActiveRecord has a multi-column primary key.

Seems to me the ActiveRecord class should support an array of column Ids for $databaseColumnId when the primary key is multi-column.

I require a multi-column primary key to keep all rows that have the same value for the first column in the primary key clustered closely in the clustered index. These ActiveRecords are list elements for lists (where the list_id is usually a member_id). When I select list elements for a given list_id, I want the row data to reside in adjacent pages of the clustered index (for maximum MySQL server performance). 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...