Just modified the original post to add the file_fdw. Again, none of the instances (PG or ClickHouse) were optimised for the workload https://ftisiot.net/posts/1brows/
In the first one, the table is dropped, recreated, populated and queries.
In the second example, the table is created from a file FDW to the CSV file.
In both examples the loading time is included in the total time