RosettaCodeData/Task/Time-a-function/DuckDB/time-a-function.duckdb
2025-08-11 18:05:26 -07:00

21 lines
378 B
Text

# A table
create or replace function countto(n) as (
with recursive cte as (
select 0 as ix
union all
select ix+1
from cte
where ix < n)
select last(ix order by ix)
from cte
);
.timer on
.print .timer is now on
.print 10^4
select length(range(0, 10_000));
select countto(10 ^ 4);
.print 10^5
select length(range(0, 100_000));
select countto(10 ^ 5);