Make the top-L client diff cost depend on what changed, not on the limit
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Problem
For a query with ORDER BY … LIMIT L, every write that touches the window rebuilds the client's whole top-L list and compares it with the previous one to find what changed. That costs O(L) per write, even though a single-row write usually moves only one or two rows in or out of the top L.
For example, on a newest-first feed with LIMIT 200, each new row means copying and comparing about 400 keys just to send the client one add and one delete. Writes that land in the buffer below the top L pay the same cost and end up sending nothing.
On busy feeds this adds up, and since the engine is single-threaded, it slows every other table too.
Proposal
The window already keeps its rows in sorted order, so it can work out the change from the position where the write landed:
- Inserted inside the top L: add it, and remove the row it pushed out.
- Removed from inside the top L: remove it, and add the row that moves up.
- Updated in place: pass the update through.
- Inserted or removed below the top L: nothing to send.
This works the same for ASC and DESC. Rarer cases keep using today's full comparison, so correctness never depends on the new path: several changes in one step, a storage read landing many rows, and pages filtered through a join condition.
The messages sent to the client must stay exactly as they are today.
Testing
- A randomized test that runs the old and new diff on the same writes and checks they produce identical output.
- A benchmark of a feed with steady inserts at different limits. Today's cost should grow with L; after the change it should stay flat.
- Ngôn ngữ chính
- Rust
- Star
- 129
- Fork
- 7
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của juspay/streamgres
-
Query optimisation: share initial snapshots across LIMIT variants of the same query (donor windows)Có thể đã có người làm @sprihaanand-juspay đã nhận 3 ngày trước. Đang mở
juspay/streamgres#58 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 Hơn một tuần Mức phù hợp với người mới 38/100
juspay/streamgres#56 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
juspay/streamgres#55 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PgBouncer transaction pooling: `prepare` runs outside the read transaction and can land on another backendCó thể đã có người làm @sprihaanand-juspay đã nhận 6 ngày trước. Đang mở
juspay/streamgres#53 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
juspay/streamgres#49 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của juspay/streamgres
Issue tương tự
-
Android: a long press's `contextmenu` event carries no point (`clientX` and `clientY` are 0)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Test connection's password prompt says the password is never saved, also for a keychain profileĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: settings bug Haiku review: no-score ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
MMFoundation/WallpaperMachine#346 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rubys/roundhouse#2473 ·
-
bug mod: quantum info
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Qiskit/qiskit#17699 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày