create_or_set_default_schema is being called once for every new cursor, which results in performing at least a select (1) as a from schemas ... query for every cursor. This practically doubles the number of queries performed, as very often cursors are only used for a single query, and there might be cases where a cursor is instantiated but never used, which will still perform the schema check query.
Moved the create_or_set_default_schema call into the connect method, so that it is called only once per connection instead of once per cursor.
create_or_set_default_schema
is being called once for every new cursor, which results in performing at least aselect (1) as a from schemas ...
query for every cursor. This practically doubles the number of queries performed, as very often cursors are only used for a single query, and there might be cases where a cursor is instantiated but never used, which will still perform the schema check query.Moved the
create_or_set_default_schema
call into theconnect
method, so that it is called only once per connection instead of once per cursor.