File: concurrent_append_index_join.test_slow

package info (click to toggle)
duckdb 1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 299,196 kB
  • sloc: cpp: 865,414; ansic: 57,292; python: 18,871; sql: 12,663; lisp: 11,751; yacc: 7,412; lex: 1,682; sh: 747; makefile: 558
file content (59 lines) | stat: -rw-r--r-- 1,122 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# name: test/sql/parallelism/interquery/concurrent_append_index_join.test_slow
# description: Test concurrent appends during an index join
# group: [interquery]

statement ok
SET immediate_transaction_mode=true

statement ok
CREATE TABLE integers AS SELECT range AS i FROM range(1000000)

statement ok
CREATE TABLE integers_2 AS SELECT range AS i FROM range(500000)

statement ok
CREATE INDEX i_index ON integers(i)

concurrentloop threadid 0 12

loop x 0 2000

onlyif threadid>=2
statement ok
INSERT INTO integers VALUES (1)

endloop

onlyif threadid<2
statement ok
BEGIN TRANSACTION

onlyif threadid<2
statement ok
SET VARIABLE initial_count = (SELECT COUNT(*) FROM integers);

loop x 0 10

onlyif threadid<2
query I
SELECT case
	when count(*)=500000+(getvariable('initial_count') - 1000000)
	then null
	else {'initial_count': getvariable('initial_count'), 'count': count(*)}
	end
 FROM integers INNER JOIN integers_2 ON (integers.i = integers_2.i)
----
NULL

endloop

onlyif threadid<2
statement ok
COMMIT

endloop

query I
SELECT COUNT(*) FROM integers INNER JOIN integers_2 ON (integers.i = integers_2.i)
----
520000