Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@M.A.HeshmatKhah:yes, the first column must not be quoted. In terms of UTF-8 bytes, the following sequence works for me with pg17: e2 80 8c 20 22 20 22 0A that is ZERO WIDTH NON-JOINER followed by space, double quote, space, double quote, newline.
replacing the index with a simple btree index on account_id is faster: why replace? Two indexes seem to make sense here: a btree index on account_id and the gin index on name alone.
Option 1: Flat table would be a maintenance nightmare, especially if you add new sources with different measurement types from the others.: why? On the contrary, having per-metric distinct columns is the option that allows a precise choice of data type per metric, which the other options do not allow. If you have to use a general-purpose RDBMS like Postgres for that, at least profit from what it's good at.