Using storage policy: s3_cache -- { echo } SET enable_filesystem_cache_on_write_operations=0; DROP TABLE IF EXISTS test; CREATE TABLE test (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='s3_cache', min_bytes_for_wide_part = 10485760; SYSTEM STOP MERGES; SYSTEM DROP FILESYSTEM CACHE; SELECT count() FROM system.filesystem_cache; 0 INSERT INTO test SELECT number, toString(number) FROM numbers(100); SELECT * FROM test FORMAT Null; SELECT count() FROM system.filesystem_cache; 2 SYSTEM DROP FILESYSTEM CACHE; SELECT count() FROM system.filesystem_cache; 0 SELECT * FROM test FORMAT Null; SELECT count() FROM system.filesystem_cache; 1 SYSTEM DROP FILESYSTEM CACHE './data'; -- { serverError 36 } SELECT count() FROM system.filesystem_cache; 1 SELECT * FROM test FORMAT Null; SELECT count() FROM system.filesystem_cache; 1 SELECT count() FROM ( SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path FROM system.remote_data_paths ) AS data_paths INNER JOIN system.filesystem_cache AS caches ON data_paths.cache_path = caches.cache_path; 1 DROP TABLE test NO DELAY; SELECT count() FROM system.filesystem_cache; 0 SELECT cache_path FROM system.filesystem_cache; SELECT cache_path, local_path FROM ( SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path FROM system.remote_data_paths ) AS data_paths INNER JOIN system.filesystem_cache AS caches ON data_paths.cache_path = caches.cache_path; DROP TABLE IF EXISTS test2; CREATE TABLE test2 (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='s3_cache_2', min_bytes_for_wide_part = 10485760; INSERT INTO test2 SELECT number, toString(number) FROM numbers(100); SELECT * FROM test2 FORMAT Null; SELECT count() FROM system.filesystem_cache; 2 SYSTEM DROP FILESYSTEM CACHE 's3_cache_2/'; SELECT count() FROM system.filesystem_cache; 0 Using storage policy: local_cache -- { echo } SET enable_filesystem_cache_on_write_operations=0; DROP TABLE IF EXISTS test; CREATE TABLE test (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='local_cache', min_bytes_for_wide_part = 10485760; SYSTEM STOP MERGES; SYSTEM DROP FILESYSTEM CACHE; SELECT count() FROM system.filesystem_cache; 0 INSERT INTO test SELECT number, toString(number) FROM numbers(100); SELECT * FROM test FORMAT Null; SELECT count() FROM system.filesystem_cache; 2 SYSTEM DROP FILESYSTEM CACHE; SELECT count() FROM system.filesystem_cache; 0 SELECT * FROM test FORMAT Null; SELECT count() FROM system.filesystem_cache; 1 SYSTEM DROP FILESYSTEM CACHE './data'; -- { serverError 36 } SELECT count() FROM system.filesystem_cache; 1 SELECT * FROM test FORMAT Null; SELECT count() FROM system.filesystem_cache; 1 SELECT count() FROM ( SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path FROM system.remote_data_paths ) AS data_paths INNER JOIN system.filesystem_cache AS caches ON data_paths.cache_path = caches.cache_path; 1 DROP TABLE test NO DELAY; SELECT count() FROM system.filesystem_cache; 0 SELECT cache_path FROM system.filesystem_cache; SELECT cache_path, local_path FROM ( SELECT arrayJoin(cache_paths) AS cache_path, local_path, remote_path FROM system.remote_data_paths ) AS data_paths INNER JOIN system.filesystem_cache AS caches ON data_paths.cache_path = caches.cache_path; DROP TABLE IF EXISTS test2; CREATE TABLE test2 (key UInt32, value String) Engine=MergeTree() ORDER BY key SETTINGS storage_policy='local_cache_2', min_bytes_for_wide_part = 10485760; INSERT INTO test2 SELECT number, toString(number) FROM numbers(100); SELECT * FROM test2 FORMAT Null; SELECT count() FROM system.filesystem_cache; 2 SYSTEM DROP FILESYSTEM CACHE 'local_cache_2/'; SELECT count() FROM system.filesystem_cache; 0