I've got a huge monster of a database (Okay that's not quite true, but there are over 8 million records in one product table).. This table is fed by 13 suppliers. Even with the best indexing I could come up with, searching for the top 10,000 records that are ready for supplier 8, is crazy slow. What I'd like to do is create a product table for each supplier and parse the table into smaller tables.
Now in c++ or what have you, I'd just switch the table that I'm working with inside the class.
In ruby, it seems I'll have to create a new class for each table, and do a migration. Also as I plan to have some in session tables #, I'd be interested in getting ruby to work with them..
Oh.. 8 million and set to grow to 20 million in the next 6 months.
A question posed, was what's my db engine.. Right now it's sql, but I'm open to pushing my db to another engine, if it will mean I can use temp tables, and "partitioned" tables.
One additional point to indexing.. Indexing on fields that change frequently isn't practical. Like price and quantity.. I'd have to re-index the changed items, each time I made a change.
def self.table_name "table_name" endtry that in your model.