Last active
May 3, 2018 13:53
-
-
Save peterbe/e582122f03a9775a65d8ea24a21f43b4 to your computer and use it in GitHub Desktop.
postgres logs, batched get_all from kinto (AFTER)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018-05-03 09:36:19.741 EDT [98312] LOG: statement: BEGIN | |
2018-05-03 09:36:19.742 EDT [98312] LOG: statement: | |
SELECT principal | |
FROM user_principals | |
WHERE user_id = 'basicauth:a9302d2ec674f91c44359646adaf7c51070ef4a3699ca596f22a543954e38c32' | |
OR user_id = 'system.Authenticated'; | |
2018-05-03 09:36:19.743 EDT [98312] LOG: statement: | |
WITH required_perms AS ( | |
VALUES ('/buckets/build-hub/collections/releases', 'write'),('/buckets/build-hub/collections/releases', 'read'),('/buckets/build-hub', 'read'),('/buckets/build-hub', 'write') | |
), | |
allowed_principals AS ( | |
SELECT principal | |
FROM required_perms JOIN access_control_entries | |
ON (object_id = column1 AND permission = column2) | |
), | |
required_principals AS ( | |
VALUES ('basicauth:a9302d2ec674f91c44359646adaf7c51070ef4a3699ca596f22a543954e38c32'),('system.Authenticated'),('system.Everyone') | |
) | |
SELECT COUNT(*) AS matched | |
FROM required_principals JOIN allowed_principals | |
ON (required_principals.column1 = principal); | |
2018-05-03 09:36:19.744 EDT [98312] LOG: statement: | |
SELECT as_epoch(last_modified) AS last_modified, data | |
FROM records | |
WHERE id = 'releases' | |
AND parent_id = '/buckets/build-hub' | |
AND collection_id = 'collection' | |
AND NOT deleted; | |
2018-05-03 09:36:19.745 EDT [98312] LOG: statement: | |
WITH existing_timestamps AS ( | |
-- Timestamp of latest record. | |
( | |
SELECT last_modified, as_epoch(last_modified) AS last_epoch | |
FROM records | |
WHERE parent_id = '/buckets/build-hub/collections/releases' | |
AND collection_id = 'record' | |
ORDER BY last_modified DESC | |
LIMIT 1 | |
) | |
-- Timestamp of empty collection. | |
UNION | |
( | |
SELECT last_modified, as_epoch(last_modified) AS last_epoch | |
FROM timestamps | |
WHERE parent_id = '/buckets/build-hub/collections/releases' | |
AND collection_id = 'record' | |
) | |
) | |
SELECT MAX(last_modified) AS last_modified, MAX(last_epoch) AS last_epoch | |
FROM existing_timestamps | |
2018-05-03 09:36:19.746 EDT [98312] LOG: statement: | |
INSERT INTO timestamps (parent_id, collection_id, last_modified) | |
VALUES ('/buckets/build-hub/collections/releases', 'record', COALESCE('2018-05-02T18:05:03.336767'::timestamp, clock_timestamp()::timestamp)) | |
ON CONFLICT (parent_id, collection_id) DO NOTHING | |
RETURNING as_epoch(last_modified) AS last_epoch | |
2018-05-03 09:36:19.748 EDT [98312] LOG: statement: | |
SELECT id, as_epoch(last_modified) AS last_modified, data | |
FROM records | |
WHERE (as_epoch(last_modified) < 1524239260824) AND | |
parent_id = '/buckets/build-hub/collections/releases' | |
AND collection_id = 'record' | |
AND NOT deleted | |
ORDER BY last_modified DESC | |
LIMIT 10000; | |
2018-05-03 09:36:19.955 EDT [98312] LOG: statement: | |
SELECT COUNT(id) AS count_total | |
FROM records | |
WHERE parent_id = '/buckets/build-hub/collections/releases' | |
AND collection_id = 'record' | |
AND NOT deleted | |
; | |
2018-05-03 09:36:20.584 EDT [98312] LOG: statement: COMMIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment