I'm curious for how the WAL works when I load a CSV file with
COPY persons(first_name, last_name, dob, email)
FROM 'C:\sampledb\persons.csv' DELIMITER ',' CSV HEADER;
So if, for example, I'm reading in a CSV file of 50 MB, how will the WAL work? Will it convert it into one big SQL statement and save that statement which is at least 50 MB in size, will it transfer the file and the statement into the pg_wal
directory or something else?
I'm using Postgres 15.
The PostgreSQL write-ahead log does not contain SQL statements. It contains low-level binary information. In your special case the WAL records will contain instructions to extend the table file by an 8kB block and the binary data to write into these blocks.