Skip to content

Instantly share code, notes, and snippets.

@sheac
Created August 11, 2020 01:49
Show Gist options
  • Save sheac/1de8608a830a9457cd1b41650db40937 to your computer and use it in GitHub Desktop.
Save sheac/1de8608a830a9457cd1b41650db40937 to your computer and use it in GitHub Desktop.
[
{
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Startup Cost": 91141.8,
"Total Cost": 91141.82,
"Plan Rows": 1,
"Plan Width": 514,
"Actual Startup Time": 167641.939,
"Actual Total Time": 167642.039,
"Actual Rows": 16,
"Actual Loops": 1,
"Shared Hit Blocks": 34203104,
"Shared Read Blocks": 59021,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Unique",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Startup Cost": 91141.8,
"Total Cost": 91141.81,
"Plan Rows": 1,
"Plan Width": 514,
"Actual Startup Time": 167641.938,
"Actual Total Time": 167642.036,
"Actual Rows": 16,
"Actual Loops": 1,
"Shared Hit Blocks": 34203104,
"Shared Read Blocks": 59021,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Sort",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Startup Cost": 91141.8,
"Total Cost": 91141.8,
"Plan Rows": 1,
"Plan Width": 514,
"Actual Startup Time": 167641.937,
"Actual Total Time": 167642.002,
"Actual Rows": 237,
"Actual Loops": 1,
"Sort Key": [
"template_set_versions.created_at DESC",
"ts.id DESC"
],
"Sort Method": "quicksort",
"Sort Space Used": 451,
"Sort Space Type": "Memory",
"Shared Hit Blocks": 34203104,
"Shared Read Blocks": 59021,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Nested Loop",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Join Type": "Inner",
"Startup Cost": 24414.23,
"Total Cost": 91141.79,
"Plan Rows": 1,
"Plan Width": 514,
"Actual Startup Time": 17111.659,
"Actual Total Time": 167640.858,
"Actual Rows": 237,
"Actual Loops": 1,
"Shared Hit Blocks": 34203104,
"Shared Read Blocks": 59021,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Nested Loop",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Join Type": "Inner",
"Startup Cost": 24413.81,
"Total Cost": 91141.34,
"Plan Rows": 1,
"Plan Width": 530,
"Actual Startup Time": 17111.309,
"Actual Total Time": 167636.51,
"Actual Rows": 237,
"Actual Loops": 1,
"Join Filter": "(SubPlan 1)",
"Rows Removed by Join Filter": 249,
"Shared Hit Blocks": 34202156,
"Shared Read Blocks": 59020,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Nested Loop",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Join Type": "Inner",
"Startup Cost": 24413.4,
"Total Cost": 86007.18,
"Plan Rows": 1,
"Plan Width": 506,
"Actual Startup Time": 7467.407,
"Actual Total Time": 29778.316,
"Actual Rows": 486,
"Actual Loops": 1,
"Join Filter": "(template_set_versions.templates @> (json_build_array(jt.id))::jsonb)",
"Rows Removed by Join Filter": 67669,
"Shared Hit Blocks": 5913643,
"Shared Read Blocks": 24911,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Merge Join",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Join Type": "Inner",
"Startup Cost": 8953.57,
"Total Cost": 25224.42,
"Plan Rows": 1,
"Plan Width": 470,
"Actual Startup Time": 1639.556,
"Actual Total Time": 2346.489,
"Actual Rows": 317,
"Actual Loops": 1,
"Merge Cond": "(template_set_versions.id = aav.actor_id)",
"Shared Hit Blocks": 89376,
"Shared Read Blocks": 9291,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Unique",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Startup Cost": 0.42,
"Total Cost": 15758.26,
"Plan Rows": 41038,
"Plan Width": 454,
"Actual Startup Time": 2.029,
"Actual Total Time": 882.691,
"Actual Rows": 61595,
"Actual Loops": 1,
"Shared Hit Blocks": 83538,
"Shared Read Blocks": 3539,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Scan Direction": "Backward",
"Index Name": "template_set_versions_pkey",
"Relation Name": "template_set_versions",
"Alias": "template_set_versions",
"Startup Cost": 0.42,
"Total Cost": 15531.71,
"Plan Rows": 90621,
"Plan Width": 454,
"Actual Startup Time": 2.028,
"Actual Total Time": 863.64,
"Actual Rows": 90500,
"Actual Loops": 1,
"Shared Hit Blocks": 83538,
"Shared Read Blocks": 3539,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
{
"Node Type": "Sort",
"Parent Relationship": "Inner",
"Parallel Aware": false,
"Startup Cost": 8953.16,
"Total Cost": 8953.16,
"Plan Rows": 3,
"Plan Width": 16,
"Actual Startup Time": 1454.05,
"Actual Total Time": 1456.116,
"Actual Rows": 6661,
"Actual Loops": 1,
"Sort Key": [
"aav.actor_id DESC"
],
"Sort Method": "quicksort",
"Sort Space Used": 505,
"Sort Space Type": "Memory",
"Shared Hit Blocks": 5838,
"Shared Read Blocks": 5752,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Nested Loop",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Join Type": "Inner",
"Startup Cost": 84.17,
"Total Cost": 8953.13,
"Plan Rows": 3,
"Plan Width": 16,
"Actual Startup Time": 10.546,
"Actual Total Time": 1451.081,
"Actual Rows": 6661,
"Actual Loops": 1,
"Shared Hit Blocks": 5838,
"Shared Read Blocks": 5752,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Nested Loop",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Join Type": "Inner",
"Startup Cost": 0.29,
"Total Cost": 2422.04,
"Plan Rows": 1,
"Plan Width": 16,
"Actual Startup Time": 9.356,
"Actual Total Time": 26.335,
"Actual Rows": 4,
"Actual Loops": 1,
"Shared Hit Blocks": 95,
"Shared Read Blocks": 1105,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Seq Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Relation Name": "attribute_values",
"Alias": "av",
"Startup Cost": 0.0,
"Total Cost": 2388.77,
"Plan Rows": 4,
"Plan Width": 32,
"Actual Startup Time": 9.001,
"Actual Total Time": 24.561,
"Actual Rows": 5,
"Actual Loops": 1,
"Filter": "((label = ANY ('{Malaysia}'::text[])) AND (archived_at = 0))",
"Rows Removed by Filter": 87411,
"Shared Hit Blocks": 85,
"Shared Read Blocks": 1100,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
{
"Node Type": "Index Scan",
"Parent Relationship": "Inner",
"Parallel Aware": false,
"Scan Direction": "Forward",
"Index Name": "attributes_pkey",
"Relation Name": "attributes",
"Alias": "a",
"Startup Cost": 0.29,
"Total Cost": 8.31,
"Plan Rows": 1,
"Plan Width": 16,
"Actual Startup Time": 0.35,
"Actual Total Time": 0.351,
"Actual Rows": 1,
"Actual Loops": 5,
"Index Cond": "(id = av.attribute_id)",
"Rows Removed by Index Recheck": 0,
"Filter": "((archived_at = 0) AND ((label)::text = 'Location'::text))",
"Rows Removed by Filter": 0,
"Shared Hit Blocks": 10,
"Shared Read Blocks": 5,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
{
"Node Type": "Bitmap Heap Scan",
"Parent Relationship": "Inner",
"Parallel Aware": false,
"Relation Name": "actor_attribute_values",
"Alias": "aav",
"Startup Cost": 83.88,
"Total Cost": 6516.54,
"Plan Rows": 1455,
"Plan Width": 32,
"Actual Startup Time": 11.502,
"Actual Total Time": 355.923,
"Actual Rows": 1665,
"Actual Loops": 4,
"Recheck Cond": "(attribute_value_id = av.id)",
"Rows Removed by Index Recheck": 0,
"Filter": "(archived_at = 0)",
"Rows Removed by Filter": 1668,
"Exact Heap Blocks": 10266,
"Lossy Heap Blocks": 0,
"Shared Hit Blocks": 5743,
"Shared Read Blocks": 4647,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Bitmap Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Index Name": "index_actor_attribute_values_on_attribute_value_id_and_actor_id",
"Startup Cost": 0.0,
"Total Cost": 83.52,
"Plan Rows": 1995,
"Plan Width": 0,
"Actual Startup Time": 10.528,
"Actual Total Time": 10.528,
"Actual Rows": 3538,
"Actual Loops": 4,
"Index Cond": "(attribute_value_id = av.id)",
"Shared Hit Blocks": 13,
"Shared Read Blocks": 111,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
}
]
}
]
}
]
},
{
"Node Type": "Bitmap Heap Scan",
"Parent Relationship": "Inner",
"Parallel Aware": false,
"Relation Name": "job_templates",
"Alias": "jt",
"Startup Cost": 15459.83,
"Total Cost": 60782.42,
"Plan Rows": 17,
"Plan Width": 36,
"Actual Startup Time": 66.55,
"Actual Total Time": 86.171,
"Actual Rows": 215,
"Actual Loops": 317,
"Recheck Cond": "((status = 'Published'::job_template_status) AND (team_id = '641cab72-e1fe-40ae-ac89-afe4aa7cbdf0'::uuid))",
"Rows Removed by Index Recheck": 17483,
"Filter": "((metadata -> '9834f929-e683-423e-847a-c258281b1e65'::text) @> '{\"__type__\": \"list\", \"__isref__\": false, \"__value__\": \"7fd92d20-cf61-4c90-ba46-f85ecad2bbfd\"}'::jsonb)",
"Rows Removed by Filter": 4690,
"Exact Heap Blocks": 4894163,
"Lossy Heap Blocks": 0,
"Shared Hit Blocks": 5823839,
"Shared Read Blocks": 15618,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "BitmapAnd",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Startup Cost": 15459.83,
"Total Cost": 15459.83,
"Plan Rows": 17398,
"Plan Width": 0,
"Actual Startup Time": 50.019,
"Actual Total Time": 50.019,
"Actual Rows": 0,
"Actual Loops": 317,
"Shared Hit Blocks": 942312,
"Shared Read Blocks": 2982,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Bitmap Index Scan",
"Parent Relationship": "Member",
"Parallel Aware": false,
"Index Name": "index_job_templates_on_status",
"Startup Cost": 0.0,
"Total Cost": 3766.72,
"Plan Rows": 93106,
"Plan Width": 0,
"Actual Startup Time": 11.56,
"Actual Total Time": 11.56,
"Actual Rows": 94436,
"Actual Loops": 317,
"Index Cond": "(status = 'Published'::job_template_status)",
"Shared Hit Blocks": 189916,
"Shared Read Blocks": 601,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
{
"Node Type": "Bitmap Index Scan",
"Parent Relationship": "Member",
"Parallel Aware": false,
"Index Name": "index_job_templates_on_team_id",
"Startup Cost": 0.0,
"Total Cost": 11692.84,
"Plan Rows": 238989,
"Plan Width": 0,
"Actual Startup Time": 30.58,
"Actual Total Time": 30.58,
"Actual Rows": 266658,
"Actual Loops": 317,
"Index Cond": "(team_id = '641cab72-e1fe-40ae-ac89-afe4aa7cbdf0'::uuid)",
"Shared Hit Blocks": 752396,
"Shared Read Blocks": 2381,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
}
]
}
]
},
{
"Node Type": "Index Scan",
"Parent Relationship": "Inner",
"Parallel Aware": false,
"Scan Direction": "Forward",
"Index Name": "template_sets_pkey",
"Relation Name": "template_sets",
"Alias": "ts",
"Startup Cost": 0.41,
"Total Cost": 0.44,
"Plan Rows": 1,
"Plan Width": 60,
"Actual Startup Time": 0.024,
"Actual Total Time": 0.025,
"Actual Rows": 1,
"Actual Loops": 486,
"Index Cond": "(id = aav.actor_id)",
"Rows Removed by Index Recheck": 0,
"Filter": "((type = ANY ('{0}'::integer[])) AND (archived_at = 0) AND (team_id = '641cab72-e1fe-40ae-ac89-afe4aa7cbdf0'::uuid))",
"Rows Removed by Filter": 0,
"Shared Hit Blocks": 1925,
"Shared Read Blocks": 19,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
{
"Node Type": "Aggregate",
"Strategy": "Hashed",
"Partial Mode": "Simple",
"Parent Relationship": "SubPlan",
"Subplan Name": "SubPlan 1",
"Parallel Aware": false,
"Startup Cost": 5125.29,
"Total Cost": 5138.75,
"Plan Rows": 1346,
"Plan Width": 20,
"Actual Startup Time": 281.911,
"Actual Total Time": 283.106,
"Actual Rows": 5857,
"Actual Loops": 486,
"Group Key": [
"mjt.id"
],
"Shared Hit Blocks": 28286588,
"Shared Read Blocks": 34090,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Bitmap Heap Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Relation Name": "job_templates",
"Alias": "mjt",
"Startup Cost": 71.18,
"Total Cost": 5118.36,
"Plan Rows": 1387,
"Plan Width": 20,
"Actual Startup Time": 33.09,
"Actual Total Time": 191.673,
"Actual Rows": 248108,
"Actual Loops": 486,
"Recheck Cond": "(team_id = ts.team_id)",
"Rows Removed by Index Recheck": 195737,
"Exact Heap Blocks": 14224734,
"Lossy Heap Blocks": 12938778,
"Shared Hit Blocks": 28286588,
"Shared Read Blocks": 34090,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Bitmap Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Index Name": "index_job_templates_on_team_id",
"Startup Cost": 0.0,
"Total Cost": 70.83,
"Plan Rows": 1387,
"Plan Width": 0,
"Actual Startup Time": 28.178,
"Actual Total Time": 28.178,
"Actual Rows": 266658,
"Actual Loops": 486,
"Index Cond": "(team_id = ts.team_id)",
"Shared Hit Blocks": 1157166,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
}
]
}
]
},
{
"Node Type": "Index Only Scan",
"Parent Relationship": "Inner",
"Parallel Aware": false,
"Scan Direction": "Forward",
"Index Name": "template_sets_pkey",
"Relation Name": "template_sets",
"Alias": "ts_1",
"Startup Cost": 0.41,
"Total Cost": 0.43,
"Plan Rows": 1,
"Plan Width": 16,
"Actual Startup Time": 0.013,
"Actual Total Time": 0.013,
"Actual Rows": 1,
"Actual Loops": 237,
"Index Cond": "(id = aav.actor_id)",
"Rows Removed by Index Recheck": 0,
"Heap Fetches": 237,
"Shared Hit Blocks": 948,
"Shared Read Blocks": 1,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
}
]
}
]
}
]
},
"Planning Time": 10.9,
"Triggers": [],
"Execution Time": 167642.184
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment