On Jun 25, 2010, at 6:53 PM, Rhett Garber wrote:
> When we make a new connection to the database (MySQL in this case), it
> appears that the dialect has some initialization functions than run
> several queries:
>
> connection duration rows query
> primary_slave/tid=9276117 4.014ms 1 'SELECT DATABASE()'
> primary_slave/tid=9276117 1.868ms 1 "SELECT CAST('test
> unicode
> returns' AS CHAR(60)) AS anon_1"
> primary_slave/tid=9276117 8.586ms 8 "SHOW VARIABLES LIKE
> 'character_set%'"
> primary_slave/tid=9276117 4.056ms 1 "SHOW VARIABLES LIKE
> 'lower_case_table_names'"
> primary_slave/tid=9276117 8.084ms 126 'SHOW COLLATION'
> primary_slave/tid=9276117 30.873ms 1 "SHOW VARIABLES LIKE
> 'sql_mode'"
>
> Is there a way to eliminate the need to make these queries ? Though we
> of course don't open new connections often, it does happen and adding
> this overhead for information that probably shouldn't change seems
> unnecessary.
>
> (MySQL 5.0.x, sqlalchemy 6.0beta)
>
Those queries happen exactly once per create_engine() statement, which is
something meant to be called once per-application-process, per database.
Because the inspection is limited to the very first connect call of the engine,
there's no real overhead here. It is necessary to get that information at
least once so that the dialect can properly render SQL for the target backend.
I would also recommend not using a beta release of 0.6. 0.6.1 is the current
version.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.