[eluser]skattabrain[/eluser]
I have a question, i have a very large database ... the inventory table has 500,000,000+ records. So query efficiency is important. I can shave down execution time by being clever about the order of my arguments.
for example, if i need to do something like this ...
select partnumber, qty, price, clientname from inv, clients where inv.Type = 'orange' and inv.Style = 'cool' and clients.clientid = inv.clientid
it's best if the the first "where" argument is going to remove the most possibilities from my results ... so if i index 'Type' and I know there are many less 'orange' Types versus Style = cool ... which could be millions, i should first say, give me type = orange.
so aside from indexing, the where argument with the most disqualification should be first, etc ...
but when i build my query using active record, it doesn't force what i want to be first. how do you control the order of your where & like arguments?