PERF: disable prepared statements
see: https://github.com/rails/rails/issues/21992
This commit is contained in:
parent
d8960007ca
commit
dfe3ecb914
|
@ -4,6 +4,19 @@ class Admin::DiagnosticsController < Admin::AdminController
|
||||||
layout false
|
layout false
|
||||||
skip_before_filter :check_xhr
|
skip_before_filter :check_xhr
|
||||||
|
|
||||||
|
def dump_statement_cache
|
||||||
|
statements = Post.exec_sql("select * from pg_prepared_statements").to_a
|
||||||
|
text = ""
|
||||||
|
|
||||||
|
statements.each do |row|
|
||||||
|
text << "name: #{row["name"]} sql: #{row["statement"]}\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
text << "\n\nCOUNT #{statements.count}"
|
||||||
|
|
||||||
|
render text: text, content_type: Mime::TEXT
|
||||||
|
end
|
||||||
|
|
||||||
def memory_stats
|
def memory_stats
|
||||||
text = nil
|
text = nil
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
development:
|
development:
|
||||||
|
prepared_statements: false
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: discourse_development
|
database: discourse_development
|
||||||
min_messages: warning
|
min_messages: warning
|
||||||
|
@ -25,6 +26,7 @@ test:
|
||||||
|
|
||||||
# profile db is used for benchmarking using the script/bench.rb script
|
# profile db is used for benchmarking using the script/bench.rb script
|
||||||
profile:
|
profile:
|
||||||
|
prepared_statements: false
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: discourse_profile
|
database: discourse_profile
|
||||||
min_messages: warning
|
min_messages: warning
|
||||||
|
|
|
@ -39,9 +39,9 @@ db_username = discourse
|
||||||
# password used to access the db
|
# password used to access the db
|
||||||
db_password =
|
db_password =
|
||||||
|
|
||||||
# allow usage of prepared statements, must be disabled for
|
# Disallow prepared statements
|
||||||
# pgpool transaction pooling
|
# see: https://github.com/rails/rails/issues/21992
|
||||||
db_prepared_statements = true
|
db_prepared_statements = false
|
||||||
|
|
||||||
# hostname running the forum
|
# hostname running the forum
|
||||||
hostname = "www.example.com"
|
hostname = "www.example.com"
|
||||||
|
|
|
@ -205,6 +205,7 @@ Discourse::Application.routes.draw do
|
||||||
|
|
||||||
get "memory_stats"=> "diagnostics#memory_stats", constraints: AdminConstraint.new
|
get "memory_stats"=> "diagnostics#memory_stats", constraints: AdminConstraint.new
|
||||||
get "dump_heap"=> "diagnostics#dump_heap", constraints: AdminConstraint.new
|
get "dump_heap"=> "diagnostics#dump_heap", constraints: AdminConstraint.new
|
||||||
|
get "dump_statement_cache"=> "diagnostics#dump_statement_cache", constraints: AdminConstraint.new
|
||||||
|
|
||||||
end # admin namespace
|
end # admin namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue