hasura / hasura/graphql-engine
Server: Subscriptions don't play well with large datasets due to use of prepared statements
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### What is the current behaviour?
Subscriptions use prepared statements for multiplexing purposes.
This can be an issue with postgres variants that have custom optimization logic implemented at query planning time.
Because some information is not available at query planning time (such as timestamp range), the planner cannot optimize the query correctly.
This can lead to terrible performance on at least timescaledb specifically.
### What is the expected behaviour?
It should be possible to disable use of prepared statements for subscriptions.
### Any possible solutions?
Currently the best workaround is to not use subscriptions and instead poll hasura.
### Reference
Internal Zendesk ticket 255
Contributor guide
Research direction
No file, test, or entry point is named in the issue. Start by locating the subscription multiplexing path and its prepared-statement handling; done means subscriptions can disable prepared statements and the behavior is covered for the PostgreSQL or TimescaleDB performance case described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100