Postgres: Count all records in spite of using offset/limit

SELECT *, count(*) OVER() AS full_count FROM tbl WHERE /* whatever */ ORDER BY col1 LIMIT ? OFFSET ?
This sentence shows the way to count all resulting records in spite of using offset/limit.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.