Skip to content

Commit 47ab467

Browse files
committed
db: don't actually create an explicit transaction for read commands.
Since we are the only writer, we don't need one. Name (time in s) Min Max Mean StdDev Median sqlite: test_spam_listcommands (before) 2.1193 2.4524 2.2343 0.1341 2.2229 sqlite: test_spam_listcommands (after) 2.0140 2.2349 2.1001 0.0893 2.0644 Postgres: test_spam_listcommands (before) 6.5572 6.8440 6.7067 0.1032 6.6967 Postgres: test_spam_listcommands (after) 4.4237 5.0024 4.6495 0.2278 4.6717 A nice 31% speedup! Changelog-Changed: Postgres: significant speedup on read-only operations (e.g. 30% on empty SELECTs) Signed-off-by: Rusty Russell <[email protected]>
1 parent b4f1750 commit 47ab467

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

db/utils.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ bool db_query_prepared_canfail(struct db_stmt *stmt)
144144
assert(stmt->query->readonly);
145145
trace_span_start("db_query_prepared", stmt);
146146
trace_span_tag(stmt, "query", stmt->query->query);
147-
db_need_transaction(stmt->db, stmt->query->query);
148147
ret = stmt->db->config->query_fn(stmt);
149148
stmt->executed = true;
150149
list_del_from(&stmt->db->pending_statements, &stmt->list);

0 commit comments

Comments
 (0)