From 872d620121706ad345b7e667521be1c7326c2e00 Mon Sep 17 00:00:00 2001 From: Chris Jaekl Date: Tue, 5 Dec 2017 22:24:49 +0900 Subject: [PATCH] Track SQL statement execution times, so that they can be profiled. As it happens, this revealed one missing index (primary key on the EFS table was not declared). Fixing that offers a modest speed-up. --- store.rb | 6 +++-- tconn.rb | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 tconn.rb diff --git a/store.rb b/store.rb index 69e1278..bf24b0e 100644 --- a/store.rb +++ b/store.rb @@ -3,6 +3,7 @@ require 'csv' require 'fileutils' require 'inifile' require 'pg' +require 'tconn' require 'series' @@ -33,7 +34,8 @@ class Store def connect # @conn = PGconn.connect('localhost', 5432, '', '', 'quanlib', 'quanlib', 'quanlib') - @conn = PG.connect(@dbhost, @dbport, '', '', @dbname, @dbuser, @dbpass) + # @conn = PG.connect(@dbhost, @dbport, '', '', @dbname, @dbuser, @dbpass) + @conn = TimedConn.new(PG.connect(@dbhost, @dbport, '', '', @dbname, @dbuser, @dbpass)) return @conn end @@ -90,7 +92,7 @@ EOS create_efs = <