Skip to content

Instantly share code, notes, and snippets.

@relwell
Created December 13, 2017 20:27
Show Gist options
  • Save relwell/43dfb7c353ea07a54770bdb0af0cd76b to your computer and use it in GitHub Desktop.
Save relwell/43dfb7c353ea07a54770bdb0af0cd76b to your computer and use it in GitHub Desktop.
skywatch=> select policies.key, policies.guid, policies.created_at, count(statuses.id) from policies left join statuses on policies.guid = statuses.policy_guid AND policies.created_at > '2017-12-11' group by policies.key, policies.guid, policies.created_at having policies.created_at > '2017-12-11';
key | guid | created_at | count
---------+--------------------------------------+----------------------------+-------
S3-090 | 804da0e9-78f5-4ee3-8b25-95350a2a049d | 2017-12-13 19:56:15.431+00 | 0
EC2-060 | c45f1eca-7299-44cd-869a-d464c532de41 | 2017-12-13 20:15:49.868+00 | 0
RDS-040 | 3768e28e-505a-4132-9ee3-8d12a6abe36b | 2017-12-13 20:15:50.105+00 | 0
RDS-180 | 4ebdace2-ee6d-4148-86d8-8de02898877a | 2017-12-12 20:27:50.595+00 | 0
EBS-020 | 55c02f96-b7b7-4c0a-ac56-e308f77190bf | 2017-12-13 20:15:49.919+00 | 0
RDS-160 | 17736529-1db1-48d6-b1a6-503d060d7c43 | 2017-12-13 16:06:52.817+00 | 0
RDS-170 | 7e59c92d-7806-4c28-bd8d-441427b7945f | 2017-12-11 10:10:49.017+00 | 0
SG-120 | 035fba08-193b-4053-8fa1-f4aa9bdca81b | 2017-12-13 20:15:49.934+00 | 0
ENI-010 | c32a4e42-7733-4753-82d6-0fac4217ab63 | 2017-12-13 20:15:50.017+00 | 0
RDS-190 | b4d8f475-7fbe-4771-84b2-5a9e322637ae | 2017-12-13 19:35:39.838+00 | 0
RDS-210 | ad8cf1b1-1022-451d-b9e8-84080212d18d | 2017-12-12 20:24:08.432+00 | 0
SG-090 | 9e3cba5c-81f0-40f8-914e-063c1df9dc4a | 2017-12-12 21:45:16.039+00 | 842
EBS-090 | d447f5e0-edff-45bd-9ad9-9a3110fd7f1a | 2017-12-12 21:12:42.535+00 | 96
RDS-200 | a41ba7e5-5c1c-4336-a2f2-eceadbec58e4 | 2017-12-12 19:35:14.928+00 | 0
EBS-010 | a08f31ae-41e4-4dea-adcf-2726236769ca | 2017-12-13 20:15:49.86+00 | 0
EBS-030 | e207de11-af21-4a59-a1f4-2f13445e527c | 2017-12-13 20:15:49.994+00 | 0
SNP-010 | 90485d5e-189c-4dbf-944b-5371d432465a | 2017-12-13 20:15:49.815+00 | 0
RDS-100 | 0edb76e9-0143-4c13-bb96-eb19ab685578 | 2017-12-12 19:45:22.873+00 | 0
(18 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment