Best way to get result count before LIMIT was applied

前端 未结 5 914
后悔当初
后悔当初 2020-11-22 12:30

When paging through data that comes from a DB, you need to know how many pages there will be to render the page jump controls.

Currently I do that by running the que

5条回答
  •  轮回少年
    2020-11-22 12:37

    Since Postgres already does a certain amount of caching things, this type of method isn't as inefficient as it seems. It's definitely not doubling execution time. We have timers built into our DB layer, so I have seen the evidence.

提交回复
热议问题