these optimizations are all fine with me, Jason Kirtland has been handling the overhaul of MySQL reflection so maybe stop by on IRC to compare notes.
On Jul 18, 12:57 am, Mike Bernson <[EMAIL PROTECTED]> wrote: > I started looking to what is happen to get table information from mysql. > > I found that the following is issued for every table that is reflected: > > 2007-07-18 00:29:08,158 INFO sqlalchemy.engine.base.Engine.0x..cc show > variables like 'character_set%%' > 2007-07-18 00:29:08,158 INFO sqlalchemy.engine.base.Engine.0x..cc None > 2007-07-18 00:29:08,161 INFO sqlalchemy.engine.base.Engine.0x..cc SHOW > VARIABLES LIKE 'lower_case_table_names' > 2007-07-18 00:29:08,161 INFO sqlalchemy.engine.base.Engine.0x..cc None > 2007-07-18 00:29:08,163 INFO sqlalchemy.engine.base.Engine.0x..cc > describe `company` > 2007-07-18 00:29:08,163 INFO sqlalchemy.engine.base.Engine.0x..cc {} > 2007-07-18 00:29:08,169 INFO sqlalchemy.engine.base.Engine.0x..cc SHOW > CREATE TABLE `company` > > I have a slow connection to the database and want to min the number of > round trips. > > It look like the show variables like should not be need for every table. > > The character_set_results is never set and should be constant for a > given connection. so the results of of _detect_character should be > cached at a min for the connection (I think it should also be cached > for the host/port combo unless it get set somewhere) > > lower_case_table_names can only be changed on server startup. It should > be easy to cache this query and only execute it once per host/port. > > The last one that can be reduce is show CREATE TABLE should have all the > information that describe has and the reflection could happen form this > command. > > I would be willing to look into getting the lower_case_table_name only > once per server. (I hint as to where this might be cached) > > I think the character_set_results can also be cached on per server since > we do set it. > I would be willing to look into write a patch that make the reflection > use show create table command. > > The first 2 should be easy and cut done the number of round trips 1/2. > > I do not see using the show create table as hard and that would cut the > number of round trips per table to 1. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---