should be it
This commit is contained in:
21
external/duckdb/test/sql/storage/update/dictionary_update_null.test
vendored
Normal file
21
external/duckdb/test/sql/storage/update/dictionary_update_null.test
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# name: test/sql/storage/update/dictionary_update_null.test
|
||||
# description: Test updating only the validity mask of a dictionary compressed column
|
||||
# group: [update]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/dictionary_update_null.db
|
||||
|
||||
statement ok
|
||||
SET force_compression='dictionary'
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE 'everflow_daily' AS SELECT case when i%10=0 THEN uuid()::VARCHAR ELSE 'N/A' END sub4 FROM range(10000) t(i)
|
||||
|
||||
statement ok
|
||||
UPDATE everflow_daily SET sub4 = NULL WHERE sub4 = 'N/A';
|
||||
|
||||
query I
|
||||
select count(*) from everflow_daily
|
||||
where sub4 = 'N/A'
|
||||
----
|
||||
0
|
||||
105
external/duckdb/test/sql/storage/update/large_repeated_updates.test_slow
vendored
Normal file
105
external/duckdb/test/sql/storage/update/large_repeated_updates.test_slow
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
# name: test/sql/storage/update/large_repeated_updates.test_slow
|
||||
# description: Test repeated updates on big table
|
||||
# group: [update]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/updates_large_repeated.db
|
||||
|
||||
statement ok
|
||||
begin transaction;
|
||||
|
||||
statement ok
|
||||
create table integers as select * from generate_series(0, 10000000, 1) tbl(i);
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000005000000
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000015000001
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000025000002
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000035000003
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000045000004
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000055000005
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000065000006
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000075000007
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000085000008
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000095000009
|
||||
|
||||
statement ok
|
||||
update integers set i=i+1;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000105000010
|
||||
|
||||
statement ok
|
||||
commit;
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000105000010
|
||||
51
external/duckdb/test/sql/storage/update/larger_than_memory_update.test_slow
vendored
Normal file
51
external/duckdb/test/sql/storage/update/larger_than_memory_update.test_slow
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# name: test/sql/storage/update/larger_than_memory_update.test_slow
|
||||
# description: Test larger than memory updates
|
||||
# group: [update]
|
||||
|
||||
load __TEST_DIR__/larger_than_memory_update.db
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers AS FROM range(10000000) t(i);
|
||||
|
||||
statement ok
|
||||
SET threads=1
|
||||
|
||||
# 10M bigints is ~75MB uncompressed
|
||||
statement ok
|
||||
SET memory_limit='8MB';
|
||||
|
||||
query II
|
||||
SELECT COUNT(*), SUM(i) FROM integers
|
||||
----
|
||||
10000000 49999995000000
|
||||
|
||||
query I
|
||||
UPDATE integers SET i=i+1;
|
||||
----
|
||||
10000000
|
||||
|
||||
query II
|
||||
SELECT COUNT(*), SUM(i) FROM integers
|
||||
----
|
||||
10000000 50000005000000
|
||||
|
||||
query I
|
||||
UPDATE integers SET i=i+1 WHERE i%2=0;
|
||||
----
|
||||
5000000
|
||||
|
||||
query II
|
||||
SELECT COUNT(*), SUM(i) FROM integers
|
||||
----
|
||||
10000000 50000010000000
|
||||
|
||||
statement ok
|
||||
BEGIN
|
||||
|
||||
query I
|
||||
UPDATE integers SET i=i+1;
|
||||
----
|
||||
10000000
|
||||
|
||||
statement ok
|
||||
ROLLBACK
|
||||
56
external/duckdb/test/sql/storage/update/larger_than_memory_update_transactions.test_slow
vendored
Normal file
56
external/duckdb/test/sql/storage/update/larger_than_memory_update_transactions.test_slow
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# name: test/sql/storage/update/larger_than_memory_update_transactions.test_slow
|
||||
# description: Test larger than memory updates with transactions
|
||||
# group: [update]
|
||||
|
||||
load __TEST_DIR__/larger_than_memory_update_transactions.db
|
||||
|
||||
statement ok
|
||||
SET threads=1
|
||||
|
||||
statement ok
|
||||
CREATE TABLE integers AS FROM range(10000000) t(i);
|
||||
|
||||
# 10M bigints is ~75MB uncompressed
|
||||
statement ok
|
||||
SET memory_limit='16MB';
|
||||
|
||||
statement ok con1
|
||||
BEGIN
|
||||
|
||||
query II con1
|
||||
SELECT COUNT(*), SUM(i) FROM integers
|
||||
----
|
||||
10000000 49999995000000
|
||||
|
||||
query I
|
||||
UPDATE integers SET i=i+1;
|
||||
----
|
||||
10000000
|
||||
|
||||
query II con1
|
||||
SELECT COUNT(*), SUM(i) FROM integers
|
||||
----
|
||||
10000000 49999995000000
|
||||
|
||||
query II
|
||||
SELECT COUNT(*), SUM(i) FROM integers
|
||||
----
|
||||
10000000 50000005000000
|
||||
|
||||
query I
|
||||
UPDATE integers SET i=i+1 WHERE i%2=0;
|
||||
----
|
||||
5000000
|
||||
|
||||
query II con1
|
||||
SELECT COUNT(*), SUM(i) FROM integers
|
||||
----
|
||||
10000000 49999995000000
|
||||
|
||||
query II
|
||||
SELECT COUNT(*), SUM(i) FROM integers
|
||||
----
|
||||
10000000 50000010000000
|
||||
|
||||
statement ok con1
|
||||
ROLLBACK
|
||||
23
external/duckdb/test/sql/storage/update/nop_update_tpch.test_slow
vendored
Normal file
23
external/duckdb/test/sql/storage/update/nop_update_tpch.test_slow
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# name: test/sql/storage/update/nop_update_tpch.test_slow
|
||||
# description: Test nop updates with TPC-H
|
||||
# group: [update]
|
||||
|
||||
require tpch
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/nop_updates_sf1.db
|
||||
|
||||
statement ok
|
||||
CALL dbgen(sf=1);
|
||||
|
||||
query I nosort expected_blocks
|
||||
SELECT total_blocks FROM pragma_database_size();
|
||||
|
||||
statement ok
|
||||
UPDATE lineitem SET l_orderkey = l_orderkey,l_partkey = l_partkey,l_suppkey = l_suppkey,l_linenumber = l_linenumber,l_quantity = l_quantity,l_extendedprice = l_extendedprice,l_discount = l_discount,l_tax = l_tax,l_returnflag = l_returnflag,l_linestatus = l_linestatus,l_shipdate = l_shipdate,l_commitdate = l_commitdate,l_receiptdate = l_receiptdate,l_shipinstruct = l_shipinstruct,l_shipmode = l_shipmode,l_comment = l_comment;
|
||||
|
||||
statement ok
|
||||
CHECKPOINT
|
||||
|
||||
query I nosort expected_blocks
|
||||
SELECT total_blocks FROM pragma_database_size();
|
||||
39
external/duckdb/test/sql/storage/update/nop_updates.test_slow
vendored
Normal file
39
external/duckdb/test/sql/storage/update/nop_updates.test_slow
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# name: test/sql/storage/update/nop_updates.test_slow
|
||||
# description: Test nop updates
|
||||
# group: [update]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/nop_updates.db
|
||||
|
||||
statement ok
|
||||
create table integers as select * from generate_series(0, 10000000, 1) tbl(i);
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
50000005000000
|
||||
|
||||
query I nosort expected_blocks
|
||||
SELECT total_blocks FROM pragma_database_size();
|
||||
|
||||
loop i 0 2
|
||||
|
||||
statement ok
|
||||
UPDATE integers SET i=i
|
||||
|
||||
endloop
|
||||
|
||||
query I nosort expected_blocks
|
||||
SELECT total_blocks FROM pragma_database_size();
|
||||
|
||||
statement ok
|
||||
CHECKPOINT
|
||||
|
||||
# ALMOST nop update
|
||||
statement ok
|
||||
UPDATE integers SET i=CASE WHEN i=9999997 THEN 42 ELSE i END
|
||||
|
||||
query I
|
||||
select sum(i) from integers
|
||||
----
|
||||
49999995000045
|
||||
55
external/duckdb/test/sql/storage/update/test_store_null_updates.test
vendored
Normal file
55
external/duckdb/test/sql/storage/update/test_store_null_updates.test
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# name: test/sql/storage/update/test_store_null_updates.test
|
||||
# description: Test updates with storage and null values
|
||||
# group: [update]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_store_updates.db
|
||||
|
||||
statement ok
|
||||
CREATE TABLE test (a INTEGER, b INTEGER);
|
||||
|
||||
statement ok
|
||||
INSERT INTO test VALUES (11, 22), (NULL, 22), (12, 21)
|
||||
|
||||
query I
|
||||
UPDATE test SET b=b+1 WHERE a=11
|
||||
----
|
||||
1
|
||||
|
||||
query II
|
||||
SELECT a, b FROM test ORDER BY a
|
||||
----
|
||||
11 23
|
||||
12 21
|
||||
NULL 22
|
||||
|
||||
query I
|
||||
UPDATE test SET b=b+1 WHERE a=11
|
||||
----
|
||||
1
|
||||
|
||||
query II
|
||||
SELECT a, b FROM test ORDER BY a
|
||||
----
|
||||
11 24
|
||||
12 21
|
||||
NULL 22
|
||||
|
||||
statement ok
|
||||
UPDATE test SET b=NULL WHERE a=11
|
||||
|
||||
query II
|
||||
SELECT a, b FROM test ORDER BY a
|
||||
----
|
||||
11 NULL
|
||||
12 21
|
||||
NULL 22
|
||||
|
||||
restart
|
||||
|
||||
query II
|
||||
SELECT a, b FROM test ORDER BY a
|
||||
----
|
||||
11 NULL
|
||||
12 21
|
||||
NULL 22
|
||||
45
external/duckdb/test/sql/storage/update/test_store_updates.test
vendored
Normal file
45
external/duckdb/test/sql/storage/update/test_store_updates.test
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# name: test/sql/storage/update/test_store_updates.test
|
||||
# description: Test updates with storage
|
||||
# group: [update]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/test_store_updates.db
|
||||
|
||||
statement ok
|
||||
CREATE TABLE test (a INTEGER, b INTEGER);
|
||||
|
||||
statement ok
|
||||
INSERT INTO test VALUES (11, 22), (13, 22), (12, 21)
|
||||
|
||||
query I
|
||||
UPDATE test SET b=b+1 WHERE a=11
|
||||
----
|
||||
1
|
||||
|
||||
query II
|
||||
SELECT a, b FROM test ORDER BY a
|
||||
----
|
||||
11 23
|
||||
12 21
|
||||
13 22
|
||||
|
||||
query I
|
||||
UPDATE test SET b=b+1 WHERE a=11
|
||||
----
|
||||
1
|
||||
|
||||
query II
|
||||
SELECT a, b FROM test ORDER BY a
|
||||
----
|
||||
11 24
|
||||
12 21
|
||||
13 22
|
||||
|
||||
restart
|
||||
|
||||
query II
|
||||
SELECT a, b FROM test ORDER BY a
|
||||
----
|
||||
11 24
|
||||
12 21
|
||||
13 22
|
||||
45
external/duckdb/test/sql/storage/update/wal_restart_update_insert.test
vendored
Normal file
45
external/duckdb/test/sql/storage/update/wal_restart_update_insert.test
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# name: test/sql/storage/update/wal_restart_update_insert.test
|
||||
# description: Test WAL restart with updates and insertions
|
||||
# group: [update]
|
||||
|
||||
# load the DB from disk
|
||||
load __TEST_DIR__/wal_restart_update_insert.test.db
|
||||
|
||||
statement ok
|
||||
CREATE TABLE test(i INTEGER PRIMARY KEY, j INTEGER);
|
||||
|
||||
statement ok
|
||||
INSERT INTO test SELECT r, r FROM range(2000) t(r);
|
||||
|
||||
statement ok
|
||||
CHECKPOINT
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_checkpoint_on_shutdown
|
||||
|
||||
statement ok
|
||||
SET checkpoint_threshold='1TB'
|
||||
|
||||
statement ok
|
||||
INSERT INTO test SELECT r, r FROM range(2000,200000) t(r)
|
||||
|
||||
statement ok
|
||||
UPDATE test SET j=j+1
|
||||
|
||||
restart
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_checkpoint_on_shutdown
|
||||
|
||||
statement ok
|
||||
SET checkpoint_threshold='1TB'
|
||||
|
||||
statement ok
|
||||
INSERT INTO test SELECT r, r FROM range(200000,400000) t(r)
|
||||
|
||||
restart
|
||||
|
||||
query I
|
||||
select count(*) FROM test
|
||||
----
|
||||
400000
|
||||
Reference in New Issue
Block a user