RosettaCodeData/Task/Time-a-function/DuckDB/time-a-function.duckdb

22 lines
378 B
Plaintext

# 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);