Skip to content
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

Support for CURSOR #1008

Open
jwoertink opened this issue Mar 6, 2024 · 0 comments
Open

Support for CURSOR #1008

jwoertink opened this issue Mar 6, 2024 · 0 comments
Labels
feature request A new requested feature / option hacktoberfest Valid Issue for Hacktoberfest

Comments

@jwoertink
Copy link
Member

A CURSOR would allow us to paginate really large collections.

I've never implemented or even really used these directly, but I found this example

-- We must be in a transaction
BEGIN;
-- Open a cursor for a query
DECLARE medley_cur CURSOR FOR SELECT * FROM medley;
-- Retrieve ten rows
FETCH 10 FROM medley_cur;
-- ...
-- Retrieve ten more from where we left off
FETCH 10 FROM medley_cur;
-- All done
COMMIT;

I honestly have no clue how this will work, but I think we would probably want some alternate method of iterating that appends the cursor to the query?

UserQuery.new.each_with_cursor(fetch: 10) do |user|
  #??
end

UserQuery.new.cursor_fetch(10).each do |user|

end

If anyone has any ideas around this, I'm open.

@jwoertink jwoertink added the feature request A new requested feature / option label Mar 17, 2024
@jwoertink jwoertink added the hacktoberfest Valid Issue for Hacktoberfest label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A new requested feature / option hacktoberfest Valid Issue for Hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant