Skip to content

Instantly share code, notes, and snippets.

@ctfaddict
Created April 24, 2014 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctfaddict/99b5fad66eab7e63838c to your computer and use it in GitHub Desktop.
Save ctfaddict/99b5fad66eab7e63838c to your computer and use it in GitHub Desktop.
scorebot_production=# select count (*) from flags where created_at = updated_at;
count
-------
12341
(1 row)
scorebot_production=# select created_at from rounds where id = 1;
created_at
----------------------------
2013-08-02 17:10:00.752457
(1 row)
scorebot_production=# select count(*) from flags where updated_at < '2013-08-02 17:10:00.752457';
count
-------
12341
(1 row)
scorebot_production=# select f2.id
from flags f2
where f2.id in (select id
from flags
where created_at = updated_at)
and f2.id in (select distinct flag_id from captures);
id
----
(0 rows)
scorebot_production=# select count(*) from (select distinct flag_id from captures) as f;
count
-------
25282
(1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment