Revision 3269
Added by Aaron Marcuse-Kubitza over 12 years ago
sql.py | ||
---|---|---|
167 | 167 |
self.log_debug = log_debug |
168 | 168 |
self.debug = log_debug != log_debug_none |
169 | 169 |
self.debug_temp = debug_temp |
170 |
self.profile_row_ct = None |
|
171 | 170 |
self.src = src |
172 | 171 |
self.autoanalyze = False |
172 |
self.autoexplain = False |
|
173 |
self.profile_row_ct = None |
|
173 | 174 |
|
174 | 175 |
self._savepoint = 0 |
175 | 176 |
self._reset() |
... | ... | |
555 | 556 |
def has_comment(query): return query.endswith('*/') |
556 | 557 |
|
557 | 558 |
def with_explain_comment(db, query, **kw_args): |
558 |
if db.debug and not has_comment(query) and is_explainable(query):
|
|
559 |
if db.autoexplain and not has_comment(query) and is_explainable(query):
|
|
559 | 560 |
query += '\n'+sql_gen.esc_comment(' EXPLAIN:\n' |
560 | 561 |
+explain(db, query, **kw_args)) |
561 | 562 |
return query |
Also available in: Unified diff
sql.py with_explain_comment(), DbConn: Fixed bug where with_explain_comment() was being run in per-row imports (row-based import and csv2db with INSERT), causing the overhead of an EXPLAIN query for every single INSERT and filling up the cache with EXPLAIN query results, by adding autoexplain mode, only running with_explain_comment() in autoexplain mode, and only enabling autoexplain mode for column-based import