postgrest icon indicating copy to clipboard operation
postgrest copied to clipboard

feat: add config to disable Prefer: count=exact

Open taimoorzaeem opened this issue 2 years ago • 2 comments

This should fix #2777.

taimoorzaeem avatar Oct 02 '23 18:10 taimoorzaeem

@taimoorzaeem Oh, #2777 was labeled as idea. I've just added a description for it: still in need of discussion, do not implement. Sorry about that :sweat_smile:. Generally I just open them to see if someone has any feedback.

So exposing count: exact is still a problem, however I'm not sure if disabling it is the correct solution.

  • count=planned is immediate but inaccurate if the statistics are out of date.
  • count=estimated depends on max-rows being set, which causes an issue https://github.com/PostgREST/postgrest/issues/2776
    • (another pending issue) I've detected that it's not working as intended when having high counts. The query is still slow.

The point of #2777 remains that it's still cumbersome to remove this value at the proxy level.

Since Prefer: tx=rollback can be disabled with a config maybe we can have a single config for all the preferences? I still need to think if this make sense but that would be better since we don't need to have one config for each preference.

Let's leave the PR open for now.

steve-chavez avatar Oct 02 '23 22:10 steve-chavez

Since Prefer: tx=rollback can be disabled with a config maybe we can have a single config for all the preferences?

FYI, added this idea on https://github.com/PostgREST/postgrest/issues/2987

steve-chavez avatar Oct 03 '23 22:10 steve-chavez