feat: stream cross-shard ORDER BY results with k-way merge#1114
feat: stream cross-shard ORDER BY results with k-way merge#1114murex971 wants to merge 5 commits into
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
|
||
| read = true; | ||
| if let Some(message) = state.forward(message)? { | ||
| if let Some(message) = state.forward_from(position, message)? { |
There was a problem hiding this comment.
nit: rename position to shard
There was a problem hiding this comment.
since it's not shard_id, rather index in connected servers list, shard could be misleading.
would change this to shard_position
|
Looks good. We would need quite a few integration tests for this one though before it's in a mergeable state. |
could you elaborate what kind of integration tests should be there ? |
|
I'm thinking, use our existing integration test setup with:
Repeat this test with as many data types as you can think of; totally fine to use the same table, can just order on different columns, e.g. varchar, bigint, timestamp(tz), etc. Let me know if you hit any errors anywhere, we need to double check our decoding logic for some more complex types. Could write them in |
|
@levkk |
|
@murex971 Thank you. Yes, this is a known limitation: https://docs.pgdog.dev/features/sharding/cross-shard-queries/select/#sorting. I agree, we should do a follow up and fix it; I'm thinking we use the same approach as we do for aggregates: add the columns temporarily into the query using the rewriter and remove them when sending the result back to the client. |
|
My apologies for delay on reviewing this. Will try to get through this by tomorrow or early next week. Please ping me again if you don't hear back in this timeframe. |
|
added an issue for this #1135 |
Description
ORDER BYqueries with a streaming k-way merge path.Related issues/comments
closes #207