MagicStack / MagicStack/asyncpg
cursor prefetch with bounded lag
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.1k
- Forks
- 468
- PR merge metrics
- No merged PRs in 30d
Description
EDIT: nvm, looks like there's really no mechanism in the pgwire protocol that would support this behavior.
Would it at all be possible to support prefetching a batch of up to N rows via a cursor, as compared to waiting for exactly N rows to be available?
In other words, I would like to have a `max_lag` parameter similar to `timeout`, but with different semantics. If after `max_lag` at least 1 row, yet less than `prefetch` rows are available, do return the available rows.
Current api is:
```
cursor(query, *args, prefetch=None, timeout=None, record_class=None)
```
I would like it to be augmented as:
```
cursor(query, *args, prefetch=None, max_lag=None, timeout=None, record_class=None)
```
Is there any intrinsic limitation that would make this not worth the effort or simply there has been no interest for anything like that?
Thank you!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by verifying the issue's stated pgwire limitation and reviewing the existing cursor API described in the report. No files or tests are named, and the requested behavior may not be implementable; completion would require a confirmed protocol-supported design and corresponding project scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100