-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimizations for INSERT #2676
Comments
The above cannot be done. We rely on counting the page total even when not using any header. This test proves it: postgrest/test/spec/Feature/Query/UpdateSpec.hs Lines 61 to 70 in 2c94455
See |
Since the query change on #2677, the above optimization no longer grants such increase. It's only about 10% in TPS now. |
While working on #2672, I noticed some optimizations we can do for INSERTs.
Our current query on
POST /complex_items Prefer: return=representation
is:Optimizations
pg_catalog.count(_postgrest_t) AS page_total
is always included, but if remove it, this grants us an increase in 12% TPS. AFAICT this is only required for:application/vnd.pgrst.object+json
Prefer: count=exact
Change the CTEs(
pgrst_payload, pgrst_body
) to LATERAL instead. This increases TPS by 6%. I got the hint of this optimization from limits don't seem to apply directly to the underlying query, causing poor performance #1652 (comment).Use
json_to_recordset
orjson_to_record
according toContent type
header and inline the json payload as a paremeter. This grants us 31% increase in TPS.pgrst_payload, pgrst_body
) and doesFROM json_to_recordset ('[{"id": 4)..')
directly.application/vnd.pgrst.array+json
media type.The text was updated successfully, but these errors were encountered: