Skip to content

Instantly share code, notes, and snippets.

@sonalkr132
Created January 13, 2019 11:15
Show Gist options
  • Save sonalkr132/a324d2d64ae85e282dea6c699cd95861 to your computer and use it in GitHub Desktop.
Save sonalkr132/a324d2d64ae85e282dea6c699cd95861 to your computer and use it in GitHub Desktop.
In dumps compared, 4 gems got more than 10 versions under an hour and 2 gems got 7 versions within a minute.
gemcutter_development=# select name, updated_at from rubygems order by updated_at desc limit 1;
name | updated_at
-------------+----------------------------
canvas_sync | 2019-01-07 21:10:22.016253
(1 row)
gemcutter_development=# select count(*) from (select date_trunc('hour',created_at) as created_at, count(*) as num, rubygem_id from versions group by 1, 3 order by num
desc) as s where s.num > 10;
count
-------
1010
(1 row)
gemcutter_development=# select count(*) from (select date_trunc('hour',created_at) as created_at, count(*) as num, rubygem_id from versions group by 1, 3 order by num
desc) as s where s.num > 20;
count
-------
281
(1 row)
### per min
gemcutter_development=# select count(*) from (select date_trunc('minute',created_at) as created_at, count(*) as num, rubygem_id from versions group by 1, 3 order by n
um desc) as s where s.num > 20;
count
-------
221
(1 row)
gemcutter_development=# select count(*) from (select date_trunc('minute',created_at) as created_at, count(*) as num, rubygem_id from versions group by 1, 3 order by num desc) as s where s.num > 6;
count
-------
1894
(1 row)
rubygems=# select name, updated_at from rubygems order by updated_at desc limit 1;
name | updated_at
---------------+----------------------------
beautiful_url | 2018-06-25 21:01:25.132539
(1 row)
rubygems=# select count(*) from (select date_trunc('hour',created_at) as created_at, count(*) as num, rubygem_id from versions group by 1, 3 order by num desc) as s w
here s.num > 10;
count
-------
1006
(1 row)
rubygems=# select count(*) from (select date_trunc('hour',created_at) as created_at, count(*) as num, rubygem_id from versions group by 1, 3 order by num desc) as s w
here s.num > 20;
count
-------
281
(1 row)
### per min
rubygems=# select count(*) from (select date_trunc('minute',created_at) as created_at, count(*) as num, rubygem_id from versions group by 1, 3 order by num desc) as s
where s.num > 20;
count
-------
221
(1 row)
rubygems=# select count(*) from (select date_trunc('minute',created_at) as created_at, count(*) as num, rubygem_id from versions group by 1, 3 order by num desc) as s where s.num > 6;
count
-------
1892
(1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment