Execution time: 2m 34s
Planning time: 0.256ms
Triggers: N/A
#1 Hash Join
#2 Seq Scan
#3 Hash
#4  └ Seq Scan

Hash Join

Inner join
on (events.data ->> 'serviceId'::text) = postgres_dbs.database_id

Seq Scan

on public.events as events

Hash

Seq Scan

on public.postgres_dbs as postgres_dbs
 [
   {
     "Plan": {
       "Node Type": "Hash Join",
       "Parallel Aware": false,
       "Async Capable": false,
       "Join Type": "Inner",
       "Startup Cost": 7160.18,
       "Total Cost": 4594354.56,
       "Plan Rows": 30031387,
       "Plan Width": 25,
       "Actual Startup Time": 50.123,
       "Actual Total Time": 154782.456,
       "Actual Rows": 11507,
       "Actual Loops": 1,
       "Output": ["events.id"],
       "Inner Unique": true,
       "Hash Cond": "((events.data ->> 'serviceId'::text) = postgres_dbs.database_id)",
       "Shared Hit Blocks": 303013,
       "Shared Read Blocks": 2855753,
       "Shared Dirtied Blocks": 1794,
       "Shared Written Blocks": 7,
       "Local Hit Blocks": 0,
       "Local Read Blocks": 0,
       "Local Dirtied Blocks": 0,
       "Local Written Blocks": 0,
       "Temp Read Blocks": 0,
       "Temp Written Blocks": 0,
       "I/O Read Time": 106844.598,
       "I/O Write Time": 0.249,
       "Temp I/O Read Time": 0.000,
       "Temp I/O Write Time": 0.000,
       "Plans": [
         {
           "Node Type": "Seq Scan",
           "Parent Relationship": "Outer",
           "Parallel Aware": false,
           "Async Capable": false,
           "Relation Name": "events",
           "Schema": "public",
           "Alias": "events",
           "Startup Cost": 0.00,
           "Total Cost": 4504604.43,
           "Plan Rows": 30031387,
           "Plan Width": 192,
           "Actual Startup Time": 0.987,
           "Actual Total Time": 149550.260,
           "Actual Rows": 10898353,
           "Actual Loops": 1,
           "Output": ["events.id", "events.\"timestamp\"", "events.type", "events.data"],+
           "Filter": "((events.data ->> 'serviceId'::text) >= 'dpg-'::text)",
           "Rows Removed by Filter": 79321312,
           "Shared Hit Blocks": 298068,
           "Shared Read Blocks": 2855753,
           "Shared Dirtied Blocks": 1794,
           "Shared Written Blocks": 7,
           "Local Hit Blocks": 0,
           "Local Read Blocks": 0,
           "Local Dirtied Blocks": 0,
           "Local Written Blocks": 0,
           "Temp Read Blocks": 0,
           "Temp Written Blocks": 0,
           "I/O Read Time": 106844.598,
           "I/O Write Time": 0.249,
           "Temp I/O Read Time": 0.000,
           "Temp I/O Write Time": 0.000
         },
         {
           "Node Type": "Hash",
           "Parent Relationship": "Inner",
           "Parallel Aware": false,
           "Async Capable": false,
           "Startup Cost": 5896.19,
           "Total Cost": 5896.19,
           "Plan Rows": 101119,
           "Plan Width": 26,
           "Actual Startup Time": 44.730,
           "Actual Total Time": 44.731,
           "Actual Rows": 103074,
           "Actual Loops": 1,
           "Output": ["postgres_dbs.database_id"],
           "Hash Buckets": 131072,
           "Original Hash Buckets": 131072,
           "Hash Batches": 1,
           "Original Hash Batches": 1,
           "Peak Memory Usage": 6904,
           "Shared Hit Blocks": 4885,
           "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,
           "I/O Read Time": 0.000,
           "I/O Write Time": 0.000,
           "Temp I/O Read Time": 0.000,
           "Temp I/O Write Time": 0.000,
           "Plans": [
             {
               "Node Type": "Seq Scan",
               "Parent Relationship": "Outer",
               "Parallel Aware": false,
               "Async Capable": false,
               "Relation Name": "postgres_dbs",
               "Schema": "public",
               "Alias": "postgres_dbs",
               "Startup Cost": 0.00,
               "Total Cost": 5896.19,
               "Plan Rows": 101119,
               "Plan Width": 26,
               "Actual Startup Time": 0.013,
               "Actual Total Time": 21.174,
               "Actual Rows": 103074,
               "Actual Loops": 1,
               "Output": ["postgres_dbs.database_id"],
               "Shared Hit Blocks": 4885,
               "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,
               "I/O Read Time": 0.000,
               "I/O Write Time": 0.000,
               "Temp I/O Read Time": 0.000,
               "Temp I/O Write Time": 0.000
             }
           ]
         }
       ]
     },
     "Query Identifier": 6994744531759900354,
     "Planning": {
       "Shared Hit Blocks": 0,
       "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,
       "I/O Read Time": 0.000,
       "I/O Write Time": 0.000,
       "Temp I/O Read Time": 0.000,
       "Temp I/O Write Time": 0.000
     },
     "Planning Time": 0.256,
     "Triggers": [
     ],
     "Execution Time": 154795.015
   }
 ]
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON)
SELECT e.id
FROM events e
JOIN postgres_dbs db ON (e.data->>'serviceId') = db.database_id
WHERE (e.data->>'serviceId') >= 'dpg-';
Table Count Time
events 1 2m 29s 97%
#2 Seq Scan 2m 29s 97%
postgres_dbs 1 21.2ms 0%
#4 Seq Scan 21.2ms 0%
Function Count Time
No function used
Node Type Count Time
Seq Scan 2 2m 29s 97%
#2 Seq Scan 2m 29s 97%
#4 Seq Scan 21.2ms 0%
Hash Join 1 5s 187ms 3%
#1 Hash Join 5s 187ms 3%
Hash 1 23.6ms 0%
#3 Hash 23.6ms 0%
Index Count Time
No index used