Skip to content

Instantly share code, notes, and snippets.

@saswata-dutta
Created October 12, 2021 10:19
Show Gist options
  • Save saswata-dutta/d22ddc1272cd250b2f68eb62db049bd2 to your computer and use it in GitHub Desktop.
Save saswata-dutta/d22ddc1272cd250b2f68eb62db049bd2 to your computer and use it in GitHub Desktop.
create table scores(id smallint primary key, score smallint not null);
CREATE INDEX score_idx ON scores (score);
WITH RECURSIVE
cnt(x) AS (
SELECT 1
UNION ALL
SELECT x+1 FROM cnt
LIMIT 10000
)
insert into scores(id, score) select x, random() from cnt;
select count(*) from scores where score <= 2673474448148295663;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment