Earlier quoted context omitted.
It makes one wonder what the software world would like if the whole notion of 'premature optimization is the root of all evil' never existed. Because that advice, well intentioned and perfectly reasonable when applied thoughtfully, gradually morphed into 'optimization is the root of all evil' contributing to this ongoing race between computers speeding up and software slowing down. And that's a scenario which a cynic…
I don't think the idea morphed into "any optimization" is evil. But it is the unfortunate consequence of leaving optimization until after functional requirements are met. Same with any kind of tech debt. A mentality of "Let's just get this out the door now any fix it later" results in later meaning never.
Querying Postgres Tables Directly from DuckDB
31–40 of 41 posts
Re: Querying Postgres Tables Directly from DuckDB
#32Re: Querying Postgres Tables Directly from DuckDB
#33This might end up being the best way to etl postgres tables to parquet. From everything else that I tried, doing a copy to CSV and then converting to parquet was the fastest but can be a pain when dealing with type conversions.
This won't let you ETL from PG to parquet, but I used this in anger the other day https://github.com/manojkarthick/pqrs Worked quite well for my purposes!
Re: Querying Postgres Tables Directly from DuckDB
#34Earlier quoted context omitted.
This won't let you ETL from PG to parquet, but I used this in anger the other day https://github.com/manojkarthick/pqrs Worked quite well for my purposes!
I was trying https://github.com/sfu-db/connector-x and hacking around with this https://github.com/spitz-dan-l/postgres-binary-parser but it turned out that a COPY to csv using asyncpg and then converting to parquet was the fastest.
In my case, I had parquet to begin with because I accidentally deleted some production data (oopsies) and when you export a snapshot from RDS to S3, it is in Parquet. Thankfully, I now have a few tricks up my sleeve to quickly restore data, but that was stressful for a bit haha
Re: Querying Postgres Tables Directly from DuckDB
#35SQLite and DuckDB are excellent demonstrations that the computers we have on our desks (and even in our pockets) are ridiculously fast and capable for almost everything but the largest workloads. They're a stark contrast to framework bloat that has stolen our CPU cycles and given us perceptible lag when typing and scrolling.
It makes one wonder what the software world would like if the whole notion of 'premature optimization is the root of all evil' never existed. Because that advice, well intentioned and perfectly reasonable when applied thoughtfully, gradually morphed into 'optimization is the root of all evil' contributing to this ongoing race between computers speeding up and software slowing down. And that's a scenario which a cynic…
Re: Querying Postgres Tables Directly from DuckDB
#36Earlier quoted context omitted.
Exactly, I almost started writing a tool for that, because nothing else I found supports arrays and composite types. Now let's hope DuckDB does support that :) If you don't use arrays and composites, Spark should be able to do it, right?
Yes, DuckDB supports writing lists and structs to Parquet! https://github.com/duckdb/duckdb/pull/2832 Does that help or do you have any other questions?
Re: Querying Postgres Tables Directly from DuckDB
#37Also, I didn't quite understand if DuckDB in order to achieve this must:
1. Read the Postgres row formatted data
2. Transform the row formatted data into its internal columnar representation
3. Keep the representation in memory
Re: Querying Postgres Tables Directly from DuckDB
#38This is exciting but it left me wondering if the approach will remain to scale with larger TPC-H scale factors? Scale factor of 1 is honestly very small. Also, I didn't quite understand if DuckDB in order to achieve this must: 1. Read the Postgres row formatted data 2. Transform the row formatted data into its internal columnar representation 3. Keep the representation in memory
No data is persisted in DuckDB unless you do an insert statement with the result of the Postgres scan. DuckDB does process that data in a columnar fashion once it has been pulled into DuckDB memory though!
Does that help?
Re: Querying Postgres Tables Directly from DuckDB
#39Earlier quoted context omitted.
Yes, DuckDB supports writing lists and structs to Parquet! https://github.com/duckdb/duckdb/pull/2832 Does that help or do you have any other questions?
Awesome. However, the postgres_scanner has problems with jsonb, it won't even connect the database which contains those :/