ClickHouse/tests/queries/0_stateless/02226_s3_with_cache.sql

71 lines
2.4 KiB
MySQL
Raw Normal View History

2022-07-12 02:30:03 +00:00
-- Tags: no-parallel, no-fasttest, long, no-random-settings
2022-02-25 10:04:16 +00:00
2022-03-09 11:44:08 +00:00
SET max_memory_usage='20G';
2022-03-30 11:47:44 +00:00
SET enable_filesystem_cache_on_write_operations = 0;
2022-03-09 11:44:08 +00:00
2022-03-30 09:54:42 +00:00
DROP TABLE IF EXISTS test;
2022-02-25 10:04:16 +00:00
CREATE TABLE test (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='s3_cache';
2022-03-10 14:34:17 +00:00
INSERT INTO test SELECT * FROM generateRandom('key UInt32, value String') LIMIT 10000;
2022-02-25 10:04:16 +00:00
SET remote_filesystem_read_method='threadpool';
SELECT 1, * FROM test LIMIT 10 FORMAT Null;
SYSTEM FLUSH LOGS;
SELECT query,
ProfileEvents['CachedReadBufferReadFromSourceBytes'] > 0 as remote_fs_read,
ProfileEvents['CachedReadBufferReadFromCacheBytes'] > 0 as remote_fs_cache_read,
ProfileEvents['CachedReadBufferCacheWriteBytes'] > 0 as remote_fs_read_and_download
2022-02-25 10:04:16 +00:00
FROM system.query_log
WHERE query LIKE 'SELECT 1, * FROM test LIMIT%'
AND type = 'QueryFinish'
2022-03-01 10:57:14 +00:00
AND current_database = currentDatabase()
2022-02-25 10:04:16 +00:00
ORDER BY query_start_time DESC
LIMIT 1;
2022-04-18 00:34:12 +00:00
set remote_filesystem_read_method = 'read';
set local_filesystem_read_method = 'pread';
2022-02-25 10:04:16 +00:00
SELECT 2, * FROM test LIMIT 10 FORMAT Null;
SYSTEM FLUSH LOGS;
SELECT query,
ProfileEvents['CachedReadBufferReadFromSourceBytes'] > 0 as remote_fs_read,
ProfileEvents['CachedReadBufferReadFromCacheBytes'] > 0 as remote_fs_cache_read,
ProfileEvents['CachedReadBufferCacheWriteBytes'] > 0 as remote_fs_read_and_download
2022-02-25 10:04:16 +00:00
FROM system.query_log
WHERE query LIKE 'SELECT 2, * FROM test LIMIT%'
AND type = 'QueryFinish'
2022-03-01 10:57:14 +00:00
AND current_database = currentDatabase()
2022-02-25 10:04:16 +00:00
ORDER BY query_start_time DESC
LIMIT 1;
2022-03-01 10:57:14 +00:00
2022-03-09 11:44:08 +00:00
SET remote_filesystem_read_method='threadpool';
SELECT * FROM test WHERE value LIKE '%abc%' ORDER BY value LIMIT 10 FORMAT Null;
2022-03-30 11:47:44 +00:00
SET enable_filesystem_cache_on_write_operations = 1;
2022-03-30 09:54:42 +00:00
TRUNCATE TABLE test;
SELECT count() FROM test;
2022-03-30 11:47:44 +00:00
SYSTEM DROP FILESYSTEM CACHE;
2022-03-30 09:54:42 +00:00
INSERT INTO test SELECT * FROM generateRandom('key UInt32, value String') LIMIT 10000;
SELECT 3, * FROM test LIMIT 10 FORMAT Null;
SYSTEM FLUSH LOGS;
SELECT query,
ProfileEvents['CachedReadBufferReadFromSourceBytes'] > 0 as remote_fs_read,
ProfileEvents['CachedReadBufferReadFromCacheBytes'] > 0 as remote_fs_cache_read,
ProfileEvents['CachedReadBufferCacheWriteBytes'] > 0 as remote_fs_read_and_download
2022-03-30 09:54:42 +00:00
FROM system.query_log
WHERE query LIKE 'SELECT 3, * FROM test LIMIT%'
AND type = 'QueryFinish'
AND current_database = currentDatabase()
ORDER BY query_start_time DESC
LIMIT 1;
2022-03-09 11:44:08 +00:00
DROP TABLE test;