Re: The hidden cost of limit-offset

2020-12-06 Thread 孙冰
I think the subquery approach should be something like: --- select id, pg_sleep(0.1) from (select id from thing offset 90 order by tag) last_things --- Is that right? Then what if the interface is exposed as a view? e.g., --- create view thing_interface as select id, tag, pg_sleep(0.1) from

Re: The hidden cost of limit-offset

2020-12-06 Thread David G. Johnston
On Sunday, December 6, 2020, 孙冰 wrote: > The skipped rows by an OFFSET clause have to be computed nevertheless. I > am wondering if there could be any chance to improve, since the computation > is on the *entire* rows rather than on the *criterial* columns. > > [...] > > I don't understand the

The hidden cost of limit-offset

2020-12-05 Thread 孙冰
The skipped rows by an OFFSET clause have to be computed nevertheless. I am wondering if there could be any chance to improve, since the computation is on the *entire* rows rather than on the *criterial* columns. Consider the following example. Create a sample table and insert some random data.