M-D
M-D

Reputation: 10397

Postgresql pagination

I came to know that PostgreSQL pagination (using LIMIT and OFFSET) is damn slow, unfortunately, its very late to me to understand this, because one of my small web app project uses it as the DB and the development is almost over.

I have seen a few workarounds in SO and other sites, but all of them uses extra indexes and things like that. But it does not suit me because I will have to create many indexes (there are a few dozens of tables) for the tables and will also have to rewrite the queries. So my question is :

  1. Is there a way I can avoid this without spending more time (creating those extra indexes and rewriting query, etc) ? I mean, a simple workaround ?

  2. I have not felt this slow with MySQL (and I guess, so is Oracle), hence, will PostgreSQL people be improving that in future versions ? or won't they do it at all ? (If they have a plan, I would like to keep on with PostgreSQL, if not I would go for MySQL, because a typical web app/ERP will have a lot of pagination requirements, and it is not wise to do extra work for this basic need)

Upvotes: 1

Views: 2909

Answers (1)

Vao Tsun
Vao Tsun

Reputation: 51436

pagination?.. if you mean LIMIT OFFSET it is quite fast. Comparing to LIMIT WHERE ROWNUM of Oracle, LIMIT N,O in mysql... Quite same in all aspects

So answers would be:

  1. Without spending time - nothing will happen
  2. Things are being improved in every version. They will do some.

NB

Upvotes: 1

Related Questions