-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmarks.sql
74 lines (57 loc) · 2.17 KB
/
benchmarks.sql
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
.timer ON
.echo ON
-- Sanity check queries
SELECT COUNT(*)
FROM stable_transactions;
SELECT COUNT(*)
FROM tags;
SELECT COUNT(*)
FROM stable_transaction_tags;
-- Owner queries
SELECT HEX(id)
FROM stable_transactions
WHERE owner_address = x'7F5229A2CD9F54F6F13D53BAE460728243325B4B64021A7685DA6B44F3C104DF'
ORDER BY height, block_transaction_index
LIMIT 100;
EXPLAIN SELECT HEX(id)
FROM stable_transactions
WHERE owner_address = x'7F5229A2CD9F54F6F13D53BAE460728243325B4B64021A7685DA6B44F3C104DF'
ORDER BY height DESC, block_transaction_index DESC
LIMIT 100;
-- Target queries
SELECT HEX(id)
FROM stable_transactions
WHERE target = x'EA9F35ED72BEC885FE841090D2A0F9C1B70FD3958F4203CA166C0D602DB1B703'
ORDER BY height, block_transaction_index
LIMIT 100;
SELECT HEX(id)
FROM stable_transactions
WHERE target = x'EA9F35ED72BEC885FE841090D2A0F9C1B70FD3958F4203CA166C0D602DB1B703'
ORDER BY height DESC, block_transaction_index DESC
LIMIT 100;
-- Tag queries
-- NOTE Sorting is based on values in the transaction tags table
SELECT HEX(st.id)
FROM stable_transactions st
JOIN stable_transaction_tags stt ON stt.height = st.height AND stt.block_transaction_index = st.block_transaction_index
WHERE stt.tag_hash = x'0ACA3398B829AA7A47D47C3BF1180D2A'
ORDER BY stt.height, stt.block_transaction_index
LIMIT 100;
SELECT HEX(st.id)
FROM stable_transactions st
JOIN stable_transaction_tags stt ON stt.height = st.height AND stt.block_transaction_index = st.block_transaction_index
WHERE stt.tag_hash = x'0ACA3398B829AA7A47D47C3BF1180D2A'
ORDER BY stt.height DESC, stt.block_transaction_index DESC
LIMIT 100;
SELECT HEX(st.id)
FROM stable_transactions st
JOIN stable_transaction_tags stt ON stt.height = st.height AND stt.block_transaction_index = st.block_transaction_index
WHERE stt.tag_hash = x'0ACA3398B829AA7A47D47C3BF1180D2A' AND stt.height < 830000
ORDER BY stt.height, stt.block_transaction_index
LIMIT 100;
SELECT HEX(st.id)
FROM stable_transactions st
JOIN stable_transaction_tags stt ON stt.height = st.height AND stt.block_transaction_index = st.block_transaction_index
WHERE stt.tag_hash = x'0ACA3398B829AA7A47D47C3BF1180D2A' AND stt.height >= 830000
ORDER BY stt.height, stt.block_transaction_index
LIMIT 100;