Skip to content

Commit

Permalink
explain的limit调整,默认全部返回
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo authored and lihuanhuan committed May 9, 2018
1 parent 78914b5 commit f6a97a3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
3 changes: 1 addition & 2 deletions sql/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,7 @@ def explain(request):

# 执行获取执行计划语句
sql_result = dao.mysql_query(masterInfo.master_host, masterInfo.master_port, masterInfo.master_user,
prpCryptor.decrypt(masterInfo.master_password), str(dbName), sqlContent,
limit_num=10000)
prpCryptor.decrypt(masterInfo.master_password), str(dbName), sqlContent)

finalResult['data'] = sql_result

Expand Down
19 changes: 5 additions & 14 deletions sql/static/sqladvisor.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,12 @@
var columns = [];
$.ajax({
type: "post",
url: "/query/",
url: "/explain/",
dataType: "json",
data: {
sql_content: 'explain ' + editor.getValue(),
cluster_name: $("#cluster_name").val(),
db_name: $("#db_name").val(),
limit_num: {{ limit_num }}
sql_content: 'explain ' + sqlContent,
cluster_name: clusterName,
db_name: dbName
},
complete: function () {
$('input[type=button]').removeClass('disabled');
Expand All @@ -279,15 +278,7 @@
else if (result['column_list']) {
//异步获取要动态生成的列
$.each(result['column_list'], function (i, column) {
columns.push({
"field": i,
"title": column,
"sortable": true,
"formatter": function (value, row, index) {
//return value;
return $('<div/>').text(value).html();
}
});
columns.push({"field": i, "title": column});
});
//初始化查询结果
$('#tb_explain').bootstrapTable('destroy').bootstrapTable({
Expand Down
1 change: 1 addition & 0 deletions sql/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
url(r'^modifyqueryprivileges/$', query.modifyqueryprivileges, name='modifyqueryprivileges'),
url(r'^query/$', query.query, name='query'),
url(r'^querylog/$', query.querylog, name='querylog'),
url(r'^explain/$', query.explain, name='explain'),
url(r'^slowquery_review/$', query.slowquery_review, name='slowquery_review'),
url(r'^slowquery_review_history/$', query.slowquery_review_history, name='slowquery_review_history'),

Expand Down
3 changes: 1 addition & 2 deletions sql/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,7 @@ def sqladvisor(request):
return HttpResponseRedirect('/admin/sql/master_config/add/')
cluster_name_list = [master.cluster_name for master in masters]

limit_num = settings.ADMIN_QUERY_LIMIT
context = {'currentMenu': 'sqladvisor', 'listAllClusterName': cluster_name_list, 'limit_num': limit_num}
context = {'currentMenu': 'sqladvisor', 'listAllClusterName': cluster_name_list}
return render(request, 'sqladvisor.html', context)


Expand Down

0 comments on commit f6a97a3

Please sign in to comment.