{"action":"closed","issue":{"url":"https://api.github.com/repos/paper-trail-gem/paper_trail/issues/1129","repository_url":"https://api.github.com/repos/paper-trail-gem/paper_trail","labels_url":"https://api.github.com/repos/paper-trail-gem/paper_trail/issues/1129/labels{/name}","comments_url":"https://api.github.com/repos/paper-trail-gem/paper_trail/issues/1129/comments","events_url":"https://api.github.com/repos/paper-trail-gem/paper_trail/issues/1129/events","html_url":"https://github.com/paper-trail-gem/paper_trail/issues/1129","id":349848540,"node_id":"MDU6SXNzdWUzNDk4NDg1NDA=","number":1129,"title":"Discussion: timestamps waste a lot of space","user":{"login":"seanlinsley","id":688886,"node_id":"MDQ6VXNlcjY4ODg4Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/688886?v=4","gravatar_id":"","url":"https://api.github.com/users/seanlinsley","html_url":"https://github.com/seanlinsley","followers_url":"https://api.github.com/users/seanlinsley/followers","following_url":"https://api.github.com/users/seanlinsley/following{/other_user}","gists_url":"https://api.github.com/users/seanlinsley/gists{/gist_id}","starred_url":"https://api.github.com/users/seanlinsley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanlinsley/subscriptions","organizations_url":"https://api.github.com/users/seanlinsley/orgs","repos_url":"https://api.github.com/users/seanlinsley/repos","events_url":"https://api.github.com/users/seanlinsley/events{/privacy}","received_events_url":"https://api.github.com/users/seanlinsley/received_events","type":"User","site_admin":false},"labels":[{"id":21496527,"node_id":"MDU6TGFiZWwyMTQ5NjUyNw==","url":"https://api.github.com/repos/paper-trail-gem/paper_trail/labels/Not%20a%20bug","name":"Not a bug","color":"3F5BA2","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-08-12T22:15:16Z","updated_at":"2018-09-04T19:26:14Z","closed_at":"2018-09-04T19:26:14Z","author_association":"MEMBER","body":"After #1046 / #1099, I thought it'd be interesting to see how much space `updated_at` ends up using. Turns out it represents 21% of the space used by `object_changes` (41% for updates).\r\n\r\nThe total amount is even higher, of course, for those that continue to use the now-optional `object` column.\r\n\r\nI put \"discussion\" in the title b/c I'm not sure what Paper Trail the project should do with this information. Are there scenarios where it's important to preserve historical changes to `updated_at`?\r\n\r\nThe two options would be to change Paper Trail's default behavior to exclude `updated_at`, or to document this issue, making it easy to resolve.\r\n\r\nIt seems unlikely that we'd change the default behavior if only b/c of momentum. So: what should the documentation look like? I'd worry that the readme is getting a bit hard to follow w/ tips like this scattered about.\r\n\r\n```sql\r\nwith data as (\r\n  select event,\r\n    count(*) / 1000000 * 1000000 as count,\r\n    sum(pg_column_size(object_changes)) as changes_size,\r\n    sum(\r\n      pg_column_size(jsonb_build_object('updated_at', object_changes->'updated_at'))\r\n        - pg_column_size('{}'::jsonb)\r\n    ) as updated_at_size\r\n  from versions group by event\r\n)\r\nselect event, count,\r\n  pg_size_pretty(changes_size) as changes_size,\r\n  pg_size_pretty(updated_at_size) as updated_at_size,\r\n  round(100.0 * updated_at_size / changes_size, 1) as percent\r\nfrom data\r\nunion all\r\nselect '(all)' as event,\r\n  sum(count) as count,\r\n  pg_size_pretty(sum(changes_size)) as changes_size,\r\n  pg_size_pretty(sum(updated_at_size)) as updated_at_size,\r\n  round(100.0 * sum(updated_at_size) / sum(changes_size), 1) as percent\r\nfrom data;\r\n\r\n  event  |  count   | changes_size | updated_at_size | percent \r\n---------+----------+--------------+-----------------+---------\r\n create  | 23000000 | 11 GB        | 1339 MB         |    11.9\r\n destroy |  2000000 | 1740 MB      | 126 MB          |     7.2\r\n update  | 31000000 | 6633 MB      | 2726 MB         |    41.1\r\n (all)   | 56000000 | 19 GB        | 4191 MB         |    21.4\r\n```"}}
{"actor":{"display_login":"jaredbeck"}}