# Result: otH6 : Optimization for: plan #lVOd

Settings

### Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 34.882 51,485.899 ↑ 1.0 1 1

Aggregate (cost=748,867,356.99..748,867,357.00 rows=1 width=8) (actual time=51,485.899..51,485.899 rows=1 loops=1)

2. 81.577 51,451.017 ↓ 3.0 300,000 1

(cost=7,488.63..748,867,106.99 rows=100,000 width=0) (actual time=0.489..51,451.017 rows=300,000 loops=1)

3. 43.586 69.440 ↓ 150.0 150,000 1

(cost=0.00..25.02 rows=1,000 width=32) (actual time=0.008..69.440 rows=150,000 loops=1)

4. 25.853 25.854 ↓ 150.0 150,000 1

ProjectSet (cost=0.00..5.02 rows=1,000 width=4) (actual time=0.003..25.854 rows=150,000 loops=1)

5. 0.001 0.001 ↑ 1.0 1 1

(cost=0.00..0.01 rows=1 width=0) (actual time=0.001..0.001 rows=1 loops=1)

6. 0.000 51,300.000 ↑ 50.0 2 150,000

(cost=7,488.63..748,866.07 rows=100 width=0) (actual time=0.183..0.342 rows=2 loops=150,000)

7. 0.000 0.000 ↑ 50.0 2 150,000

Function Scan on unnest key (cost=0.00..1.00 rows=100 width=32) (actual time=0.000..0.000 rows=2 loops=150,000)

8. 300.000 51,300.000 ↑ 1.0 1 300,000

(cost=7,488.63..7,488.63 rows=1 width=176) (actual time=0.170..0.171 rows=1 loops=300,000)

9. 4,800.000 51,000.000 ↑ 507.0 1 300,000

(cost=7,488.63..7,489.90 rows=507 width=176) (actual time=0.170..0.170 rows=1 loops=300,000)

• Sort Key: es.created_at DESC
• Sort Method: top-N heapsort Memory: 25kB
10. 46,200.000 46,200.000 ↑ 5.5 92 300,000

Index Scan using foobars2 on event_series es (cost=0.56..7,486.09 rows=507 width=176) (actual time=0.008..0.154 rows=92 loops=300,000)

• Index Cond: (entity_id = ((((generate_series(1, 150000)))::text || '_1'::text)))
• Filter: ((created_at < '2019-01-01 00:00:00'::timestamp without time zone) AND (key = key.key))
• Rows Removed by Filter: 258
Planning time Execution time : 0.317 ms : 51,485.962 ms