Skip to content

Instantly share code, notes, and snippets.

@eeshangarg
Created May 5, 2018 19:56
Show Gist options
  • Save eeshangarg/eb7986539bf6caaa88f9f76285febc02 to your computer and use it in GitHub Desktop.
Save eeshangarg/eb7986539bf6caaa88f9f76285febc02 to your computer and use it in GitHub Desktop.
The diff depicting the one extra SQL query after my changes/refactor (zerver.tests.test_messages.StreamMessagesTest.test_not_too_many_queries).t
--- data_without_changes.json 2018-05-05 16:35:40.522986224 -0230
+++ data_with_changes.json 2018-05-05 16:33:37.482789614 -0230
@@ -4,15 +4,19 @@
"time": "0.000"
},
{
+ "sql": "SELECT COUNT(*) AS \"__count\" FROM \"zerver_subscription\" INNER JOIN \"zerver_recipient\" ON (\"zerver_subscription\".\"recipient_id\" = \"zerver_recipient\".\"id\") INNER JOIN \"zerver_userprofile\" ON (\"zerver_subscription\".\"user_profile_id\" = \"zerver_userprofile\".\"id\") WHERE (\"zerver_recipient\".\"type\" = 2 AND \"zerver_subscription\".\"active\" = true AND \"zerver_recipient\".\"type_id\" = 1 AND \"zerver_userprofile\".\"is_active\" = true)",
+ "time": "0.000"
+ },
+ {
"sql": "SELECT \"zerver_recipient\".\"id\", \"zerver_recipient\".\"type_id\", \"zerver_recipient\".\"type\" FROM \"zerver_recipient\" WHERE (\"zerver_recipient\".\"type\" = 2 AND \"zerver_recipient\".\"type_id\" = 1)",
"time": "0.000"
},
{
- "sql": "SELECT \"zerver_subscription\".\"user_profile_id\", \"zerver_subscription\".\"push_notifications\", \"zerver_subscription\".\"in_home_view\" FROM \"zerver_subscription\" INNER JOIN \"zerver_recipient\" ON (\"zerver_subscription\".\"recipient_id\" = \"zerver_recipient\".\"id\") WHERE (\"zerver_recipient\".\"type\" = 2 AND \"zerver_recipient\".\"type_id\" = 1 AND \"zerver_subscription\".\"active\" = true) ORDER BY \"zerver_subscription\".\"user_profile_id\" ASC",
+ "sql": "SELECT \"zerver_subscription\".\"user_profile_id\", \"zerver_subscription\".\"push_notifications\", \"zerver_subscription\".\"in_home_view\" FROM \"zerver_subscription\" INNER JOIN \"zerver_recipient\" ON (\"zerver_subscription\".\"recipient_id\" = \"zerver_recipient\".\"id\") WHERE (\"zerver_recipient\".\"type\" = 2 AND \"zerver_subscription\".\"active\" = true AND \"zerver_recipient\".\"type_id\" = 1) ORDER BY \"zerver_subscription\".\"user_profile_id\" ASC",
"time": "0.000"
},
{
- "sql": "SELECT \"zerver_mutedtopic\".\"user_profile_id\" FROM \"zerver_mutedtopic\" WHERE (\"zerver_mutedtopic\".\"stream_id\" = 1 AND UPPER(\"zerver_mutedtopic\".\"topic_name\"::text) = UPPER('foo'))",
+ "sql": "SELECT \"zerver_mutedtopic\".\"user_profile_id\" FROM \"zerver_mutedtopic\" WHERE (UPPER(\"zerver_mutedtopic\".\"topic_name\"::text) = UPPER('foo') AND \"zerver_mutedtopic\".\"stream_id\" = 1)",
"time": "0.000"
},
{
@@ -32,7 +36,7 @@
"time": "0.000"
},
{
- "sql": "INSERT INTO \"zerver_message\" (\"sender_id\", \"recipient_id\", \"subject\", \"content\", \"rendered_content\", \"rendered_content_version\", \"pub_date\", \"sending_client_id\", \"last_edit_time\", \"edit_history\", \"has_attachment\", \"has_image\", \"has_link\") VALUES (4, 23, 'foo', 'whatever', '<p>whatever</p>', 1, '2018-05-05T19:05:00.773959+00:00'::timestamptz, 98, NULL, NULL, false, false, false) RETURNING \"zerver_message\".\"id\"",
+ "sql": "INSERT INTO \"zerver_message\" (\"sender_id\", \"recipient_id\", \"subject\", \"content\", \"rendered_content\", \"rendered_content_version\", \"pub_date\", \"sending_client_id\", \"last_edit_time\", \"edit_history\", \"has_attachment\", \"has_image\", \"has_link\") VALUES (4, 23, 'foo', 'whatever', '<p>whatever</p>', 1, '2018-05-05T19:02:01.449600+00:00'::timestamptz, 98, NULL, NULL, false, false, false) RETURNING \"zerver_message\".\"id\"",
"time": "0.000"
},
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment