1

Is there a "rule of thumb" to when it is right to take partial result from a table, rather than the whole table?

Consider my current dilemma:

  • SQL view that has total of ~1200 items, the view is not so complex only joining from several tables.
  • Query for some property, total results ~600 records
  • Using on UI with ng-repeater
  • 50 results per page

I would like to say that as a 'rule of thumb' if it is less than 1000 records I will bring the whole table. (Unless the view is really complex and takes more than 1 second to populate).

Otherwise I will bring the first 2 pages (100 results) and then 50 per page switch.

Would you agree?

  • What''s the concern? Performance at server side? At client-side? At db server? Band width, usability and UX? – Laiv Jun 8 '17 at 6:23
  • Not really a concern I just wonder what approach to take. I know all of the things you wrote should take into considerations but that's what I am asking. What would you do? The query takes less than half a second to complete. The size of the results is not a problem bandwidth-wise. @Laiv – Ziv Weissman Jun 8 '17 at 6:30
  • 1
    I would not paginate at db side. But that's quite opinionated answer. 1000 rows is nothing for Javascript and HTML. But that can no be considered rule of thumb. Nobody can say what's best for you :-). Don't overthink this too much. Implement the simplest solution. – Laiv Jun 8 '17 at 6:35
2

This is performance tuning. You have to try it and see. Try the same way your users will use it when it's deployed. Write code that makes it easy to adjust this setting by only expressing your decision in one place. When in doubt, try it out.

Speculation and performance go together like kittens and nuclear bombs.

|improve this answer|||||
1

According to your comments, there's not any specific issue to address. It's matter of establishing rules o methodologies to make your application consistent. That's fine, but the question has many possible and good answers. And in this specific case, mostly opinion based.

So, as @CandiedOrange suggest, do some conocept tests with different approaches to get your own conclusions.

Don't take what others do as reference. People do what it works for them. You have to do what works for you. Ideally, you will ask to the requirements to find the solution. In the case of doubts, keep it simple.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.