You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gem'pg',ARGV[0]ifARGV[0]require'pg'conn=PG::Connection.new(user: "sequel_test")conn.exec("DROP TABLE IF EXISTS accounts;")conn.exec("CREATE TABLE accounts (id integer default 0);")conn.exec("INSERT INTO accounts DEFAULT VALUES;")18.timesdoconn.exec("INSERT INTO accounts SELECT * FROM accounts;")endconn.send_query("SELECT * FROM accounts")conn.set_single_row_modeconn.blockt=Time.nownilwhileconn.get_resultputs"#{Time.now - t} seconds"
Results (ruby is ruby 3.1.1p18, but this same issue occurs for all Ruby versions tested):
Originally discovered by @janko and reported at jeremyevans/sequel#1846, but determined to be a ruby-pg issue and not a Sequel issue. You can probably mitigate this issue by using stream_each, but currently that cannot be used by sequel_pg. I'll send a pull request for the changes needed to make it usable by sequel_pg.
The text was updated successfully, but these errors were encountered:
conn.block still reads data from the socket, but only after checking the result queue and waiting for readability first.
Reading data from the socket (PQconsumeInput) takes much more time than just checking available results (PQisBusy).
So doing it as a precaution to conn.block is a performance issue, now that we call block before each get_result in pg-1.3.x.
The test was introduced in commit 09bdc16 .
It is not particular specific to conn.block, so that we can check the error class on consume_input equaly.
Fixes#442
Reproducer:
Results (
ruby
isruby 3.1.1p18
, but this same issue occurs for all Ruby versions tested):Originally discovered by @janko and reported at jeremyevans/sequel#1846, but determined to be a ruby-pg issue and not a Sequel issue. You can probably mitigate this issue by using
stream_each
, but currently that cannot be used by sequel_pg. I'll send a pull request for the changes needed to make it usable by sequel_pg.The text was updated successfully, but these errors were encountered: