bad performance of LIMIT/OFFSET

Robert Koch gms_xy at gmx.de
Fri Oct 17 11:05:08 CEST 2014


SELECT
    col1
FROM
    tbl
WHERE
    col1 = 1
;

is executed in 5 ms. Table has 1 billion rows, resultset is about 350 rows.

Same statement, but with LIMIT/OFFSET

SELECT
    col1
FROM
    tbl
WHERE
    col1 = 1
LIMIT 1 OFFSET 0
;

is executed in 1,03 s. Can't believe that subsetting from 350 to 1 takes 1 second.



More information about the developers-list mailing list