pgsql mode now works with Redshift server. Its working, but need to eventually split this to another Redshift section (because obviously this doesn't work with PGSQL any more)

This commit is contained in:
Robins Tharakan
2016-11-23 07:32:59 +00:00
parent 7085367623
commit 23689175eb
5 changed files with 29 additions and 20 deletions

View File

@ -36,7 +36,7 @@ pad CHAR(60) DEFAULT '' NOT NULL,
elseif (db_driver == "pgsql") then
query = [[
CREATE TABLE sbtest]] .. i .. [[ (
id SERIAL NOT NULL,
id BIGINT IDENTITY(100, 10) NOT NULL,
k INTEGER DEFAULT '0' NOT NULL,
c CHAR(120) DEFAULT '' NOT NULL,
pad CHAR(60) DEFAULT '' NOT NULL,
@ -142,11 +142,11 @@ function set_vars()
oltp_range_selects = true
end
if (oltp_auto_inc == 'off') then
oltp_auto_inc = false
else
-- if (oltp_auto_inc == 'off') then
-- oltp_auto_inc = false
-- else
oltp_auto_inc = true
end
-- end
if (oltp_read_only == 'on') then
oltp_read_only = true
@ -170,10 +170,10 @@ function set_vars()
oltp_skip_trx = false
end
if (oltp_create_secondary == 'off') then
-- if (oltp_create_secondary == 'off') then
oltp_create_secondary = false
else
oltp_create_secondary = true
end
-- else
-- oltp_create_secondary = true
-- end
end

View File

@ -25,6 +25,7 @@ function event(thread_id)
pad_val = sb_rand_str([[
###########-###########-###########-###########-###########]])
oltp_auto_inc = true
if (db_driver == "pgsql" and oltp_auto_inc) then
rs = db_query("INSERT INTO " .. table_name .. " (k, c, pad) VALUES " ..
string.format("(%d, '%s', '%s')", k_val, c_val, pad_val))

View File

@ -99,8 +99,14 @@ function event(thread_id)
###########-###########-###########-###########-###########-###########-###########-###########-###########-###########]])
pad_val = sb_rand_str([[
###########-###########-###########-###########-###########]])
rs = db_query("INSERT INTO " .. table_name .. " (id, k, c, pad) VALUES " .. string.format("(%d, %d, '%s', '%s')",i, sb_rand(1, oltp_table_size) , c_val, pad_val))
oltp_auto_inc = true
if (oltp_auto_inc) then
rs = db_query("INSERT INTO " .. table_name .. " (k, c, pad) VALUES " .. string.format("(%d, '%s', '%s')",sb_rand(1, oltp_table_size) , c_val, pad_val))
else
rs = db_query("INSERT INTO " .. table_name .. " (id, k, c, pad) VALUES " .. string.format("(%d, %d, '%s', '%s')",i, sb_rand(1, oltp_table_size) , c_val, pad_val))
end
end

View File

@ -71,6 +71,7 @@ function prepare()
db_query("CREATE INDEX k on sbtest(k)")
print("Inserting " .. oltp_table_size .. " records into 'sbtest'")
oltp_auto_inc = true
if (oltp_auto_inc) then
db_bulk_insert_init("INSERT INTO sbtest(k, c, pad) VALUES")
@ -139,9 +140,9 @@ function set_vars()
oltp_table_size = oltp_table_size or 10000
random_points = random_points or 10
if (oltp_auto_inc == 'off') then
oltp_auto_inc = false
else
-- if (oltp_auto_inc == 'off') then
-- oltp_auto_inc = false
-- else
oltp_auto_inc = true
end
-- end
end

View File

@ -71,7 +71,8 @@ function prepare()
db_query("CREATE INDEX k on sbtest(k)")
print("Inserting " .. oltp_table_size .. " records into 'sbtest'")
oltp_auto_inc = true
if (oltp_auto_inc) then
db_bulk_insert_init("INSERT INTO sbtest(k, c, pad) VALUES")
else
@ -142,9 +143,9 @@ function set_vars()
number_of_ranges = number_of_ranges or 10
delta = random_ranges_delta or 5
if (oltp_auto_inc == 'off') then
oltp_auto_inc = false
else
-- if (oltp_auto_inc == 'off') then
-- oltp_auto_inc = false
-- else
oltp_auto_inc = true
end
-- end
end