Sha256: 9fcaf6e9a83822beb08afd707aaa3663818ca7f2e08012b6ae2eaf9cad209e7c

Contents?: true

Size: 651 Bytes

Versions: 11

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony/postgres'

def get_records
  $db.query('select 1 as test')
  # puts "got #{res.ntuples} records: #{res.to_a}"
rescue StandardError => e
  puts "got error: #{e.inspect}"
  puts e.backtrace.join("\n")
end

time_printer = spin do
  last = Time.now
  throttled_loop(10) do
    now = Time.now
    puts now - last
    last = now
  end
end

$db = PG.connect(
  host:     '/tmp',
  user:     'reality',
  password: nil,
  dbname:   'reality',
  sslmode:  'require'
)

X = 10_000
t0 = Time.now
X.times { get_records }
puts "query rate: #{X / (Time.now - t0)} reqs/s"

time_printer.stop

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
polyphony-0.30 examples/interfaces/pg_client.rb
polyphony-0.29 examples/interfaces/pg_client.rb
polyphony-0.28 examples/interfaces/pg_client.rb
polyphony-0.27 examples/interfaces/pg_client.rb
polyphony-0.26 examples/interfaces/pg_client.rb
polyphony-0.25 examples/interfaces/pg_client.rb
polyphony-0.24 examples/interfaces/pg_client.rb
polyphony-0.23 examples/interfaces/pg_client.rb
polyphony-0.22 examples/interfaces/pg_client.rb
polyphony-0.21 examples/interfaces/pg_client.rb
polyphony-0.20 examples/interfaces/pg_client.rb