# Database Discussions > PostgreSQL >  Equivalent of rank and partition function

## Karthika

Hi all,

I have to retrive the top n records in each group.
In Oracle I could achieve this easily using partition and rank function.

I need to achieve this same function using postgres.

Thanks in advance.

----------

