-
Notifications
You must be signed in to change notification settings - Fork 11.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] [indexer-alt] Add object filter queries #20847
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
03402fc
to
2453720
Compare
"(object_id = '\\x{}'::bytea AND cp_sequence_number <= {})", | ||
hex::encode(&o.object_id), | ||
o.cp_sequence_number | ||
) | ||
}) | ||
.collect::<Vec<_>>() | ||
.join(" OR "); | ||
let query = format!( | ||
" | ||
SELECT obj_versions.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or filtering with postgres always makes me cry, it makes the query planner do inefficient stuff, usually. on graphql, what we've ended up doing is just to fetch the latest objects, and then filter in the application
max_cp_per_object AS ( | ||
SELECT | ||
object_id, | ||
MAX(cp_sequence_number) AS max_cp_sequence_number | ||
FROM | ||
obj_info | ||
WHERE | ||
cp_sequence_number <= {view_checkpoint_number} | ||
GROUP BY | ||
object_id | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would scan the entire table right? I see that it's needed to filter out older object entries that might match the filtering conditions ... can't think of a neat way around this though. We could use a window function to find the latest version in a single pass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this query is out-of-dated! I forgot to update it to use LEFT JOIN
2453720
to
a5bc652
Compare
Description
This PR is to add queries that reads from the obj_info table. Still WIP, but sending out early.
Test plan
How did you test the new or updated feature?
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.