PeerDB-io / peerdb_fdw

PostgreSQL License
0 stars 0 forks source link

Aggregates are not getting pushed down #7

Open saisrirampur opened 1 year ago

saisrirampur commented 1 year ago

Community postgres_fdw

EXPLAIN VERBOSE SELECT id,count(*) FROM events_fdw WHERE event_type='next' GROUP BY id LIMIT 100; QUERY PLAN

Limit (cost=100.08..147.06 rows=14 width=12) Output: id, (count()) -> Foreign Scan (cost=100.08..147.06 rows=14 width=12) Output: id, (count()) Relations: Aggregate on (public.events_fdw) Remote SQL: SELECT id, count(*) FROM my_bq_b.events WHERE ((event_type = 'next'::text)) GROUP BY 1 (6 rows)

peerdb fork:

EXPLAIN VERBOSE SELECT id,count(*) FROM events_fdw WHERE event_type='next' GROUP BY id LIMIT 100; QUERY PLAN

Limit (cost=100.00..5167.50 rows=100 width=12) Output: id, (count()) -> GroupAggregate (cost=100.00..10235.00 rows=200 width=12) Output: id, count() Group Key: events_fdw.id -> Foreign Scan on public.events_fdw (cost=100.00..10208.00 rows=5000 width=4) Output: id, user_id, event_type, os, device, ip, time_spent, domain_name, payload Remote SQL: SELECT id FROM my_bq_b.events WHERE ((event_type = 'next'::text)) ORDER BY id ASC NULLS LAST (8 rows)

iskakaushik commented 1 year ago

x-ref: https://github.com/PeerDB-io/nexus/issues/264