We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a349704 commit fba93b8Copy full SHA for fba93b8
debug_toolbar/views.py
@@ -77,7 +77,15 @@ def sql_explain(request):
77
if sql.lower().strip().startswith('select'):
78
params = simplejson.loads(params)
79
cursor = connection.cursor()
80
- cursor.execute("EXPLAIN %s" % (sql,), params)
+
81
+ if settings.DATABASE_ENGINE == "sqlite3":
82
+ # SQLite's EXPLAIN dumps the low-level opcodes generated for a query;
83
+ # EXPLAIN QUERY PLAN dumps a more human-readable summary
84
+ # See http://www.sqlite.org/lang_explain.html for details
85
+ cursor.execute("EXPLAIN QUERY PLAN %s" % (sql,), params)
86
+ else:
87
+ cursor.execute("EXPLAIN %s" % (sql,), params)
88
89
headers = [d[0] for d in cursor.description]
90
result = cursor.fetchall()
91
cursor.close()
0 commit comments