Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9152433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:02:41+00:00 2026-06-17T12:02:41+00:00

tl;dr Performing basic pagination in Firebase via startAt , endAt and limit is terribly

  • 0

tl;dr Performing basic pagination in Firebase via startAt, endAt and limit is terribly complicated, there must be an easier way.

I’m constructing an administration interface for a large number of user submissions. My initial (and current) idea is to simply fetch everything and perform pagination on the client. There is however a noticable delay when fetching 2000+ records (containing 5-6 small number/string fields each) which I attribute to a data payload of over 1.5mb.

Currently all entries are added via push but I’m a bit lost as to how paginate through the huge list.

To fetch the first page of data I’m using endAt with a limit of 5:

ref.endAt().limit(10).on('child_added', function(snapshot) {
    console.log(snapshot.name(), snapshot.val().name)
})

which results in the following:

-IlNo79stfiYZ61fFkx3 #46 John
-IlNo7AmMk0iXp98oKh5 #47 Robert
-IlNo7BeDXbEe7rB6IQ3 #48 Andrew
-IlNo7CX-WzM0caCS0Xp #49 Frank
-IlNo7DNA0SzEe8Sua16 #50 Jimmmy

Firstly to figure out how many pages there are I am keeping a separate counter that’s updated whenever someone adds or removes a record.

Secondly since I’m using push I have no way of navigating to a specific page since I don’t know the name of the last record for a specific page meaning an interface like this is not currently possible:

Standard pagination controls

To make it simpler I decided on simply having next/previous buttons, this however also presents a new problem; if I use the name of the first record in the previous result-set I can paginate to the next page using the following:

ref.endAt(null, '-IlNo79stfiYZ61fFkx3').limit(5).on('child_added', function(snapshot) {
    console.log(snapshot.name(), snapshot.val().name)
})

The result of this operation is as follows:

-IlNo76KDsN53rB1xb-K #42 William
-IlNo77CtgQvjuonF2nH #43 Christian
-IlNo7857XWfMipCa8bv #44 Jim
-IlNo78z11Bkj-XJjbg_ #45 Richard
-IlNo79stfiYZ61fFkx3 #46 John

Now I have the next page except it’s shifted one position meaning I have to adjust my limit and ignore the last record.

To move back one page I’ll have to keep a separate list on the client of every record I’ve received so far and figure out what name to pass to startAt.

Is there an easier way of doing this or should I just go back to fetching everything?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:02:42+00:00Added an answer on June 17, 2026 at 12:02 pm

    We’re working on adding an “offset()” query to allow for easy pagination. We’ll also be adding a special endpoint to allow you to read the number of children at a location without actually loading them from the server.

    Both of these are going to take a bit though. In the meantime the method you describe (or doing it all on the client) are probably your best bet.

    If you have a data structure that is append-only, you could potentially also do pagination when you write the data. For example: put the first 50 in /page1, put the second 50 in /page2, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a good pattern for performing basic property editing via a
I am performing asynchronous HTTP (Ajax) requests via jQuery with the basic $.ajax(). The
I need a control that allows loading a picture, performing some basic drawing tasks
As per my understanding, JDBC Connection Pooling (at a basic level) works this way:
Using the 'units module for performing basic conversions between units. However it does not
I am performing basic form validation using the code below and am wanting to
I have a basic CRUD view-scoped bean. Within the setter methods I am performing
I'm performing what I believed was a pretty basic task. We have an environment
I am performing HTTP Basic Authentication in my Android application. Recently, however, I have
I want to update data via web service in Android. performing POST operation for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.