There seems to be no option with codeigniter's active record to enable EXPLAIN before SQL statements. It would be nice having it in the profiler for example.
Yes indeed! I would love to see this in the profiler.
yes that would be a great feature. the only thing i can see as a problem is that the different databases handles it very different.
see here for examples http://stackoverflow.com/questions/1357975/explain-select-in-other-databases
It seems to me that this should be handled in the individual db drivers because each different database has different explain syntax. Instead of printing them in the in the profiler, I think an explain function should just return the results which would allow users to print/log/email or do whatever else they want to with them. Thoughts?
Should there be an explain() method in the DB_Driver, with optional parameters?
No expectation about what it returns, nor about the parameter interpretation ... just an expectation that each database driver will implement it in an appropriate fashion.
Yes, I think there should be an explain() method in the DB_Driver, but I'm not sure what optional parameters it would need. Shouldn't it just take in the query to be explained?
"No, I don't think we should have [put functionality name here]" - said no user ever. :)