Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pagination: Needed but Problematic

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →

Pagination: Needed but Problematic

Avatar for IGB Vayupranaditya P

IGB Vayupranaditya P

May 22, 2021

Other Decks in Programming

Transcript

  1. About me I Gusti Bagus Vayupranaditya P Informatics @ Telkom

    University • Programmer @ Proclub • Likes to join competitive programming competition Ex Backend Engineer Intern @ Garena • Design, create, deploy, and maintain services for hundreds of thousands of users • Research new technologies, methods, algorithms for production uses linkedin.com/in/vayupranaditya github.com/vayupranaditya closa.me/vay
  2. What to do? As software is a result of a

    team, we can also tackle problems as a team
  3. What to do? As software is a result of a

    team, we can also tackle problems as a team Approaches: • Backend • Frontend • Product
  4. Backend solution • Good indexing is a must Read more

    on http://gg.gg/medium-dbindexing
  5. Backend solution • Good indexing is a must • Caching

    + Fast because using in-memory storage + Support high-load request - Expensive
  6. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method)
  7. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method)
  8. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method) How exactly?
  9. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method) id user_id item_id seek_number 15478 9660609 472039 1 17229 3004676 3319360 1 84582 9660609 5395528 2 87296 1772092 8339172 1 89519 9660609 8933407 3 125599 9660609 3239712 4 148158 1772092 8441369 2 162545 9660609 4005824 5 229591 9660609 3840137 6 302868 9660609 8896916 7
  10. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method) id user_id item_id seek_number 15478 9660609 472039 1 17229 3004676 3319360 1 84582 9660609 5395528 2 87296 1772092 8339172 1 89519 9660609 8933407 3 125599 9660609 3239712 4 148158 1772092 8441369 2 162545 9660609 4005824 5 229591 9660609 3840137 6 302868 9660609 8896916 7
  11. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method) id user_id item_id seek_number 15478 9660609 472039 1 17229 3004676 3319360 1 84582 9660609 5395528 2 87296 1772092 8339172 1 89519 9660609 8933407 3 125599 9660609 3239712 4 148158 1772092 8441369 2 162545 9660609 4005824 5 229591 9660609 3840137 6 302868 9660609 8896916 7
  12. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method) id user_id item_id seek_number 15478 9660609 472039 1 17229 3004676 3319360 1 84582 9660609 5395528 2 87296 1772092 8339172 1 89519 9660609 8933407 3 125599 9660609 3239712 4 148158 1772092 8441369 2 162545 9660609 4005824 5 229591 9660609 3840137 6 302868 9660609 8896916 7
  13. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method) id user_id item_id seek_number 15478 9660609 472039 1 17229 3004676 3319360 1 84582 9660609 5395528 2 87296 1772092 8339172 1 89519 9660609 8933407 3 125599 9660609 3239712 4 148158 1772092 8441369 2 162545 9660609 4005824 5 229591 9660609 3840137 6 302868 9660609 8896916 7
  14. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method) id user_id item_id seek_number 125599 9660609 3239712 4 162545 9660609 4005824 5 229591 9660609 3840137 6
  15. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method) Seek Method • seek_number can be changed into anything • seek_number needs to be indexed id user_id item_id seek_number 125599 9660609 3239712 4 162545 9660609 4005824 5 229591 9660609 3840137 6
  16. Backend solution • Good indexing is a must • Caching

    • More algorithms (ie. seek method) Seek Method • seek_number can be changed into anything • seek_number needs to be indexed + Fast: O(n) - Spec need to be defined correctly id user_id item_id seek_number 125599 9660609 3239712 4 162545 9660609 4005824 5 229591 9660609 3840137 6
  17. Frontend solution Frontend caching • All data stored in local

    storage • API called only once • Data then filtered as required
  18. Frontend solution Frontend caching • All data stored in local

    storage • API called only once • Data then filtered as required + Lower network call + Lower backend load - Data is not consistent - More complex on high-update data
  19. Product-PoV Solution More filters • Basically not a pagination •

    Benefiting from human psychology “no one is really looking into 9th page” + Fast + Intuitive + Only using WHERE clause on backend - Might need to implement advanced filtering - Can be very long / very short if using invalid filter