June 2024
Intermediate to advanced
456 pages
11h 34m
English
PostgreSQL makes it possible to connect to foreign data sources using functionality called foreign data wrappers (FDW).
The file foreign data wrapper module[331] (file_fdw) can be used to work with a CSV file as if it were a read-only table. When you have a large amount of data represented in a file, this can be a nice way to query it and work with it without needing to import it.
Let’s try this out.
To create a table, you’ll need a source CSV file. The PostgreSQL documentation has an example you’ll use here. Use the postgresql.log from your PostgreSQL installation, but first, you’ll need to enable the CSV logging format.
To do that, edit your postgresql.conf by changing the log_destination to csvlog ...
Read now
Unlock full access