add LIMIT 1000 by default

This commit is contained in:
Kane York 2015-06-25 14:55:06 -07:00
parent 2c71bc11aa
commit c933c50dc2

View File

@ -82,16 +82,16 @@ after_initialize do
ActiveRecord::Base.exec_sql "SET TRANSACTION READ ONLY" ActiveRecord::Base.exec_sql "SET TRANSACTION READ ONLY"
# SQL comments are for the benefits of the slow queries log # SQL comments are for the benefits of the slow queries log
sql = <<SQL sql = <<SQL
/* /*
DataExplorer Query * DataExplorer Query
Query: /admin/plugins/explorer/#{query.id} * Query: /admin/plugins/explorer/#{query.id}
Started by: #{opts[:current_user]} * Started by: #{opts[:current_user]}
*/ */
WITH query AS ( WITH query AS (
#{query.sql} #{query.sql}
) SELECT * FROM query ) SELECT * FROM query
LIMIT #{opts[:limit] || 1000}
SQL SQL
time_start = Time.now time_start = Time.now