Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
ClickHouse launches Claude-powered Agents and House Mates partner program at Open House 2026 Read more →
The loop table function in ClickHouse is used to return query results in an infinite loop.
SELECT ... FROM loop(database, table); SELECT ... FROM loop(database.table); SELECT ... FROM loop(table); SELECT ... FROM loop(other_table_function(...));
database
table
other_table_function(...)
SELECT * FROM loop(numbers(10));
numbers(10)
SELECT * FROM loop(test_database, test_table); SELECT * FROM loop(test_database.test_table); SELECT * FROM loop(test_table);
SELECT * FROM loop(numbers(3)) LIMIT 7; ┌─number─┐ 1. │ 0 │ 2. │ 1 │ 3. │ 2 │ └────────┘ ┌─number─┐ 4. │ 0 │ 5. │ 1 │ 6. │ 2 │ └────────┘ ┌─number─┐ 7. │ 0 │ └────────┘
SELECT * FROM loop(mysql('localhost:3306', 'test', 'test', 'user', 'password')); ...
Was this page helpful?