Closed rausnitz closed 1 year ago
I had an idea for a better way to handle this which not only makes INSERT queries behave deterministically, but also actually improves the performance instead of worsening it. I implemented it on an identically-named branch which I will open a new PR for momentarily.
When composing insert queries, the order of the columns is non-deterministic. This hurts query monitoring and analytics.
In a Postgres database we work with,
SELECT * FROM pg_stat_statements WHERE query like 'INSERT INTO "my_insert_heavy_table"%';
returns more than 3,100 rows. The relevant tablemy_insert_heavy_table
has many columns, thus many possible column orders when it's non-deterministic. I think if we make the order deterministic, these 3,100 different queries could be treated as one query for monitoring purposes.Resolves https://github.com/vapor/fluent-kit/issues/543