Skip to content

Commit e3a20ea

Browse files
committed
Add support for PostgreSQL
1 parent 10856a5 commit e3a20ea

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tpcc_common.lua

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ function cmd_prepare()
7878
end
7979

8080
-- make sure all tables are created before we load data
81+
82+
if drv:name() == "pgsql" then
83+
show_query="select * from pg_catalog.pg_tables where schemaname != 'information_schema' and schemaname != 'pg_catalog'"
84+
end
85+
8186
repeat
8287
rs= con:query(show_query)
8388
ffi.C.usleep(1000)
@@ -355,6 +360,20 @@ function set_isolation_level(drv,con)
355360

356361
con:query("SET SESSION " .. isolation_variable .. "='".. isolation_level .."'")
357362
end
363+
364+
if drv:name() == "pgsql"
365+
then
366+
if sysbench.opt.trx_level == "RR" then
367+
isolation_level="REPEATABLE READ"
368+
elseif sysbench.opt.trx_level == "RC" then
369+
isolation_level="READ COMMITTED"
370+
elseif sysbench.opt.trx_level == "SER" then
371+
isolation_level="SERIALIZABLE"
372+
end
373+
374+
con:query("SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL " .. isolation_level )
375+
end
376+
358377
end
359378

360379

0 commit comments

Comments
 (0)