paradedb / pg_analytics

DuckDB-powered analytics for Postgres
https://paradedb.com
GNU Affero General Public License v3.0
125 stars 8 forks source link

Support for views #54

Open BigBerny opened 1 month ago

BigBerny commented 1 month ago

What feature are you requesting?

Querying a view that is on top of a pg_lakehouse/DuckDB table doesn't work and returns an error.

Why are you requesting this feature?

We need views to join two tables and add some dynamic columns to our static parquet files.

What is your proposed implementation for this feature?

No response

Full Name:

Janis

Affiliation:

Typewise

paulotten commented 1 month ago

Hi @BigBerny,

What's the text of the error message?

Do you have a minimal reproducible example?


I tried starting from https://github.com/paradedb/paradedb/tree/dev/pg_lakehouse#usage then doing

CREATE TABLE rate_code (
    id INT PRIMARY KEY,
    name TEXT
);

INSERT INTO rate_code
(id, name)
VALUES
(1, 'one'),
(2, 'two'),
(3, 'three'),
(4, 'four'),
(5, 'five'),
(99, 'ninety nine');

create view trips_with_rate_code as
select *
from trips
join rate_code
on trips.ratecodeid = rate_code.id;

select *
from trips_with_rate_code
limit 3;

All of these steps worked for me.

BigBerny commented 1 month ago

I didn't even do a join, just a view (SELECT * FROM foreigntable) on the foreign table. When querying the view, it was not able to push down to DuckDB which resulted in very slow queries that timed out because of data volume.