diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-18 11:15:40 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-18 11:15:40 -0300 |
commit | 1aeb5e723648f63e49b91e5d660ccfc7dc4a0674 (patch) | |
tree | f0c859c6cad68fa6a04742bc216aad437fe8edbf /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | |
parent | d1756ba91b7e5ff80322f434f8348e6e471f0511 (diff) | |
parent | 1a7338d868d68ecef899fb8d81cf37852cc94a8c (diff) | |
download | rails-1aeb5e723648f63e49b91e5d660ccfc7dc4a0674.tar.gz rails-1aeb5e723648f63e49b91e5d660ccfc7dc4a0674.tar.bz2 rails-1aeb5e723648f63e49b91e5d660ccfc7dc4a0674.zip |
Merge pull request #14790 from krisselden/optimize-postgres-selects
Optimize select_value, select_values, select_rows in Postgresql adapter.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 0485093123..1f1bd342d1 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -662,6 +662,14 @@ module ActiveRecord FEATURE_NOT_SUPPORTED = "0A000" #:nodoc: + def execute_and_clear(sql, name, binds) + result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) : + exec_cache(sql, name, binds) + ret = yield result + result.clear + ret + end + def exec_no_cache(sql, name, binds) log(sql, name, binds) { @connection.async_exec(sql) } end |