{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/normandy/issues/1589","repository_url":"https://api.github.com/repos/mozilla/normandy","labels_url":"https://api.github.com/repos/mozilla/normandy/issues/1589/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/normandy/issues/1589/comments","events_url":"https://api.github.com/repos/mozilla/normandy/issues/1589/events","html_url":"https://github.com/mozilla/normandy/issues/1589","id":371638410,"node_id":"MDU6SXNzdWUzNzE2Mzg0MTA=","number":1589,"title":"validate_channels and validate_locales executed on GET /api/v2/recipe/","user":{"login":"peterbe","id":26739,"node_id":"MDQ6VXNlcjI2NzM5","avatar_url":"https://avatars2.githubusercontent.com/u/26739?v=4","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-10-18T17:43:16Z","updated_at":"2018-10-18T18:33:24Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"When I do:\r\n```\r\ncurl http://localhost:8000/api/v2/recipe/\\?ordering\\=-last_updated\\&page\\=1\r\n```\r\nI see the following SQL select statements:\r\n\r\n<details>\r\n<summary>All SQL needed for /api/v2/recipe/</summary>\r\n2018-10-18 13:37:20.602 EDT [60025] LOG:  statement: SET TIME ZONE 'UTC'\r\n2018-10-18 13:37:20.603 EDT [60025] LOG:  statement: SELECT COUNT(*) AS \"__count\" FROM \"recipes_recipe\"\r\n2018-10-18 13:37:20.606 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\", \"recipes_reciperevision\".\"id\", \"recipes_reciperevision\".\"parent_id\", \"recipes_reciperevision\".\"recipe_id\", \"recipes_reciperevision\".\"created\", \"recipes_reciperevision\".\"updated\", \"recipes_reciperevision\".\"user_id\", \"recipes_reciperevision\".\"name\", \"recipes_reciperevision\".\"action_id\", \"recipes_reciperevision\".\"arguments_json\", \"recipes_reciperevision\".\"extra_filter_expression\", \"recipes_reciperevision\".\"filter_object_json\", \"recipes_reciperevision\".\"identicon_seed\", \"recipes_reciperevision\".\"enabled_state_id\", \"recipes_reciperevision\".\"comment\", \"recipes_reciperevision\".\"bug_number\", \"recipes_action\".\"id\", \"recipes_action\".\"name\", \"recipes_action\".\"implementation\", \"recipes_action\".\"implementation_hash\", \"recipes_action\".\"arguments_schema_json\", \"recipes_action\".\"signature_id\", \"recipes_approvalrequest\".\"id\", \"recipes_approvalrequest\".\"revision_id\", \"recipes_approvalrequest\".\"created\", \"recipes_approvalrequest\".\"creator_id\", \"recipes_approvalrequest\".\"approved\", \"recipes_approvalrequest\".\"approver_id\", \"recipes_approvalrequest\".\"comment\" FROM \"recipes_recipe\" LEFT OUTER JOIN \"recipes_reciperevision\" ON (\"recipes_recipe\".\"latest_revision_id\" = \"recipes_reciperevision\".\"id\") LEFT OUTER JOIN \"recipes_action\" ON (\"recipes_reciperevision\".\"action_id\" = \"recipes_action\".\"id\") LEFT OUTER JOIN \"recipes_approvalrequest\" ON (\"recipes_reciperevision\".\"id\" = \"recipes_approvalrequest\".\"revision_id\") ORDER BY \"recipes_reciperevision\".\"updated\" DESC LIMIT 10\r\n2018-10-18 13:37:20.616 EDT [60025] LOG:  statement: SELECT (\"recipes_reciperevision_channels\".\"reciperevision_id\") AS \"_prefetch_related_val_reciperevision_id\", \"recipes_channel\".\"id\", \"recipes_channel\".\"slug\", \"recipes_channel\".\"name\" FROM \"recipes_channel\" INNER JOIN \"recipes_reciperevision_channels\" ON (\"recipes_channel\".\"id\" = \"recipes_reciperevision_channels\".\"channel_id\") WHERE \"recipes_reciperevision_channels\".\"reciperevision_id\" IN (4, 102, 40, 106, 11, 108, 113, 114, 18, 52) ORDER BY \"recipes_channel\".\"slug\" ASC\r\n2018-10-18 13:37:20.621 EDT [60025] LOG:  statement: SELECT (\"recipes_reciperevision_countries\".\"reciperevision_id\") AS \"_prefetch_related_val_reciperevision_id\", \"recipes_country\".\"id\", \"recipes_country\".\"code\", \"recipes_country\".\"name\" FROM \"recipes_country\" INNER JOIN \"recipes_reciperevision_countries\" ON (\"recipes_country\".\"id\" = \"recipes_reciperevision_countries\".\"country_id\") WHERE \"recipes_reciperevision_countries\".\"reciperevision_id\" IN (4, 102, 40, 106, 11, 108, 113, 114, 18, 52) ORDER BY \"recipes_country\".\"name\" ASC\r\n2018-10-18 13:37:20.626 EDT [60025] LOG:  statement: SELECT (\"recipes_reciperevision_locales\".\"reciperevision_id\") AS \"_prefetch_related_val_reciperevision_id\", \"recipes_locale\".\"id\", \"recipes_locale\".\"code\", \"recipes_locale\".\"name\" FROM \"recipes_locale\" INNER JOIN \"recipes_reciperevision_locales\" ON (\"recipes_locale\".\"id\" = \"recipes_reciperevision_locales\".\"locale_id\") WHERE \"recipes_reciperevision_locales\".\"reciperevision_id\" IN (4, 102, 40, 106, 11, 108, 113, 114, 18, 52) ORDER BY \"recipes_locale\".\"name\" ASC\r\n2018-10-18 13:37:20.632 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_locale\" WHERE \"recipes_locale\".\"code\" = 'sv-SE' LIMIT 1\r\n2018-10-18 13:37:20.634 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_country\" WHERE \"recipes_country\".\"code\" = 'SE' LIMIT 1\r\n2018-10-18 13:37:20.635 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'beta' LIMIT 1\r\n2018-10-18 13:37:20.635 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'nightly' LIMIT 1\r\n2018-10-18 13:37:20.638 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 12\r\n2018-10-18 13:37:20.640 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_locale\" WHERE \"recipes_locale\".\"code\" = 'sv-SE' LIMIT 1\r\n2018-10-18 13:37:20.641 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_country\" WHERE \"recipes_country\".\"code\" = 'SE' LIMIT 1\r\n2018-10-18 13:37:20.642 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'beta' LIMIT 1\r\n2018-10-18 13:37:20.643 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'nightly' LIMIT 1\r\n2018-10-18 13:37:20.645 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.647 EDT [60025] LOG:  statement: SELECT \"recipes_reciperevision\".\"id\", \"recipes_reciperevision\".\"parent_id\", \"recipes_reciperevision\".\"recipe_id\", \"recipes_reciperevision\".\"created\", \"recipes_reciperevision\".\"updated\", \"recipes_reciperevision\".\"user_id\", \"recipes_reciperevision\".\"name\", \"recipes_reciperevision\".\"action_id\", \"recipes_reciperevision\".\"arguments_json\", \"recipes_reciperevision\".\"extra_filter_expression\", \"recipes_reciperevision\".\"filter_object_json\", \"recipes_reciperevision\".\"identicon_seed\", \"recipes_reciperevision\".\"enabled_state_id\", \"recipes_reciperevision\".\"comment\", \"recipes_reciperevision\".\"bug_number\" FROM \"recipes_reciperevision\" WHERE \"recipes_reciperevision\".\"id\" = 110\r\n2018-10-18 13:37:20.648 EDT [60025] LOG:  statement: SELECT \"recipes_action\".\"id\", \"recipes_action\".\"name\", \"recipes_action\".\"implementation\", \"recipes_action\".\"implementation_hash\", \"recipes_action\".\"arguments_schema_json\", \"recipes_action\".\"signature_id\" FROM \"recipes_action\" WHERE \"recipes_action\".\"id\" = 1\r\n2018-10-18 13:37:20.650 EDT [60025] LOG:  statement: SELECT \"recipes_approvalrequest\".\"id\", \"recipes_approvalrequest\".\"revision_id\", \"recipes_approvalrequest\".\"created\", \"recipes_approvalrequest\".\"creator_id\", \"recipes_approvalrequest\".\"approved\", \"recipes_approvalrequest\".\"approver_id\", \"recipes_approvalrequest\".\"comment\" FROM \"recipes_approvalrequest\" WHERE \"recipes_approvalrequest\".\"revision_id\" = 110\r\n2018-10-18 13:37:20.652 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.653 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.653 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 20\r\n2018-10-18 13:37:20.656 EDT [60025] LOG:  statement: SELECT \"recipes_enabledstate\".\"id\", \"recipes_enabledstate\".\"revision_id\", \"recipes_enabledstate\".\"created\", \"recipes_enabledstate\".\"creator_id\", \"recipes_enabledstate\".\"enabled\", \"recipes_enabledstate\".\"carryover_from_id\" FROM \"recipes_enabledstate\" WHERE \"recipes_enabledstate\".\"id\" = 1\r\n2018-10-18 13:37:20.657 EDT [60025] LOG:  statement: SELECT COUNT(*) AS \"__count\" FROM \"recipes_locale\" INNER JOIN \"recipes_reciperevision_locales\" ON (\"recipes_locale\".\"id\" = \"recipes_reciperevision_locales\".\"locale_id\") WHERE \"recipes_reciperevision_locales\".\"reciperevision_id\" = 110\r\n2018-10-18 13:37:20.658 EDT [60025] LOG:  statement: SELECT COUNT(*) AS \"__count\" FROM \"recipes_country\" INNER JOIN \"recipes_reciperevision_countries\" ON (\"recipes_country\".\"id\" = \"recipes_reciperevision_countries\".\"country_id\") WHERE \"recipes_reciperevision_countries\".\"reciperevision_id\" = 110\r\n2018-10-18 13:37:20.659 EDT [60025] LOG:  statement: SELECT COUNT(*) AS \"__count\" FROM \"recipes_channel\" INNER JOIN \"recipes_reciperevision_channels\" ON (\"recipes_channel\".\"id\" = \"recipes_reciperevision_channels\".\"channel_id\") WHERE \"recipes_reciperevision_channels\".\"reciperevision_id\" = 110\r\n2018-10-18 13:37:20.659 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'beta' LIMIT 1\r\n2018-10-18 13:37:20.660 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.661 EDT [60025] LOG:  statement: SELECT COUNT(*) AS \"__count\" FROM \"recipes_locale\" INNER JOIN \"recipes_reciperevision_locales\" ON (\"recipes_locale\".\"id\" = \"recipes_reciperevision_locales\".\"locale_id\") WHERE \"recipes_reciperevision_locales\".\"reciperevision_id\" = 110\r\n2018-10-18 13:37:20.662 EDT [60025] LOG:  statement: SELECT COUNT(*) AS \"__count\" FROM \"recipes_country\" INNER JOIN \"recipes_reciperevision_countries\" ON (\"recipes_country\".\"id\" = \"recipes_reciperevision_countries\".\"country_id\") WHERE \"recipes_reciperevision_countries\".\"reciperevision_id\" = 110\r\n2018-10-18 13:37:20.663 EDT [60025] LOG:  statement: SELECT COUNT(*) AS \"__count\" FROM \"recipes_channel\" INNER JOIN \"recipes_reciperevision_channels\" ON (\"recipes_channel\".\"id\" = \"recipes_reciperevision_channels\".\"channel_id\") WHERE \"recipes_reciperevision_channels\".\"reciperevision_id\" = 110\r\n2018-10-18 13:37:20.664 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'beta' LIMIT 1\r\n2018-10-18 13:37:20.665 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 20\r\n2018-10-18 13:37:20.668 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.670 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'beta' LIMIT 1\r\n2018-10-18 13:37:20.671 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 19\r\n2018-10-18 13:37:20.673 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'beta' LIMIT 1\r\n2018-10-18 13:37:20.674 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.676 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_country\" WHERE \"recipes_country\".\"code\" = 'AS' LIMIT 1\r\n2018-10-18 13:37:20.677 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_country\" WHERE \"recipes_country\".\"code\" = 'AI' LIMIT 1\r\n2018-10-18 13:37:20.678 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 16\r\n2018-10-18 13:37:20.681 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_country\" WHERE \"recipes_country\".\"code\" = 'AS' LIMIT 1\r\n2018-10-18 13:37:20.681 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_country\" WHERE \"recipes_country\".\"code\" = 'AI' LIMIT 1\r\n2018-10-18 13:37:20.683 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.686 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 18\r\n2018-10-18 13:37:20.689 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.691 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_country\" WHERE \"recipes_country\".\"code\" = 'AF' LIMIT 1\r\n2018-10-18 13:37:20.692 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 17\r\n2018-10-18 13:37:20.695 EDT [60025] LOG:  statement: SELECT (1) AS \"a\" FROM \"recipes_country\" WHERE \"recipes_country\".\"code\" = 'AF' LIMIT 1\r\n2018-10-18 13:37:20.696 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.697 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 11\r\n2018-10-18 13:37:20.699 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.701 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 15\r\n2018-10-18 13:37:20.703 EDT [60025] LOG:  statement: SELECT \"auth_user\".\"id\", \"auth_user\".\"password\", \"auth_user\".\"last_login\", \"auth_user\".\"is_superuser\", \"auth_user\".\"username\", \"auth_user\".\"first_name\", \"auth_user\".\"last_name\", \"auth_user\".\"email\", \"auth_user\".\"is_staff\", \"auth_user\".\"is_active\", \"auth_user\".\"date_joined\" FROM \"auth_user\" WHERE \"auth_user\".\"id\" = 4\r\n2018-10-18 13:37:20.705 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 10\r\n2018-10-18 13:37:20.708 EDT [60025] LOG:  statement: SELECT \"recipes_recipe\".\"id\", \"recipes_recipe\".\"latest_revision_id\", \"recipes_recipe\".\"approved_revision_id\", \"recipes_recipe\".\"signature_id\" FROM \"recipes_recipe\" WHERE \"recipes_recipe\".\"id\" = 14\r\n\r\n</details>\r\n\r\nThat's 55 SELECT statements. \r\nPotentially bad prefetching or select_related aside, it does execute things like:\r\n\r\n```sql\r\nSELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'nightly' LIMIT 1;\r\nSELECT (1) AS \"a\" FROM \"recipes_channel\" WHERE \"recipes_channel\".\"slug\" = 'beta' LIMIT 1;\r\nSELECT (1) AS \"a\" FROM \"recipes_country\" WHERE \"recipes_country\".\"code\" = 'SE' LIMIT 1;\r\nSELECT (1) AS \"a\" FROM \"recipes_locale\" WHERE \"recipes_locale\".\"code\" = 'sv-SE' LIMIT 1;\r\n```\r\netc.\r\n\r\nIt's a bit weird because I thought things like [`validate_channels`](https://github.com/mozilla/normandy/blob/23f23bea0c4bfb5eabd012f33bd3830e5b536ce3/normandy/recipes/filters.py#L56) where only for when you try to do writes. \r\n"},"comment":{"url":"https://api.github.com/repos/mozilla/normandy/issues/comments/431115814","html_url":"https://github.com/mozilla/normandy/issues/1589#issuecomment-431115814","issue_url":"https://api.github.com/repos/mozilla/normandy/issues/1589","id":431115814,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTExNTgxNA==","user":{"login":"mythmon","id":305049,"node_id":"MDQ6VXNlcjMwNTA0OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/305049?v=4","gravatar_id":"","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"created_at":"2018-10-18T18:33:24Z","updated_at":"2018-10-18T18:33:24Z","author_association":"MEMBER","body":"Something worth pointing out, all of our \"hot paths\" have tests that assert they make a \"reasonable\" number of DB queries. These API endpoints aren't considered hot so haven't been optimized for performance. However, these tests do cover `/api/v1/recipe/signed/`, which should be triggering this failure. I think it is because the recipes made in the hot path tests don't include an filter objects.\r\n\r\nI wonder if there is a way to trick DRF into allowing us to skip the verification, since we can be fairly sure the data is correct. Or perhaps we need to skip DRF's serializers entirely for this side of the equation."}}
{"actor":{"display_login":"mythmon"}}