PostgreSQL - LIMIT clause Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The PostgreSQL LIMIT clause is a handy tool used to fetch a specific subset of rows returned by a query. This clause is optional and can be a powerful way to control the amount of data your query returns, especially when working with large datasets. Let us better understand the LIMIT Clause in PostgreSQL from this article.SyntaxSELECT * FROM table_name LIMIT n;ParametersNow let's analyze the syntax above: SELECT * FROM table_name: This part of the query specifies the table from which you want to retrieve data.LIMIT n: If "n" is skipped or equal to NULL it returns all the query results. PostgreSQL LIMIT clause ExamplesFor the sake of this article we will be using the sample DVD rental database, which is explained here and can be downloaded by clicking on this link. Now, let's look into a few examples. Example 1: Fetching the First 10 FilmsIn this example we will be using the LIMIT clause to get the first 10 films ordered by the "film_id" from the "film" table of our sample database. Query:SELECT film_id, title, rating FROM film ORDER BY film_id LIMIT 10;Output:Explanation: This query will return the first 10 films based on their 'film_id'.Example 2: Fetching the Top 10 Most Expensive FilmsIn this example we will be using the LIMIT clause to get the top 10 expensive films ordered by the "rental_rate" from the "film" table of our sample database. Query:SELECT film_id, title, rental_rate FROM film ORDER BY rental_rate DESC LIMIT 10;Output:Explanation: This query will return the top 10 films with the highest rental rates.Important Points About PostgreSQL LIMIT clauseWithout ORDER BY, the rows returned by LIMIT are not guaranteed to be in any specific order.When using LIMIT with complex queries involving joins, aggregations, or window functions, the position of the LIMIT clause can significantly impact the query result and performance. Always ensure that LIMIT is applied at the correct level of the query.The LIMIT clause is often used in conjunction with the OFFSET clause to paginate results. The OFFSET clause skips a specified number of rows before beginning to return rows from the query. Comment More info R rajukumar19 Follow Improve Article Tags : PostgreSQL postgreSQL-clauses Explore BasicsPostgreSQL Tutorial8 min readWhat is PostgreSQL - Introduction2 min readInstall PostgreSQL on Windows2 min readInstall PostgreSQL on Mac3 min readDatabase OperationsPostgreSQL - Create Database5 min readPostgreSQL - Loading a Database3 min readPostgreSQL ALTER DATABASE3 min readPostgreSQL - Rename Database4 min readPostgreSQL - Show Databases3 min readData TypesPostgreSQL - Data Types5 min readPostgreSQL - Boolean Data Type4 min readPostgreSQL - CHAR Data Type5 min readPostgreSQL - VARCHAR Data Type3 min readPostgreSQL - NUMERIC Data Type5 min readPostgreSQL - Date Data Type4 min readPostgreSQL - TIME Data Type4 min readPostgreSQL - JSON Data Type4 min readPostgreSQL - CREATE DOMAIN3 min readQuerying TablesPostgreSQL - SELECT3 min readPostgreSQL - ORDER BY clause2 min readPostgreSQL - WHERE clause6 min readPostgreSQL FETCH Clause4 min readPostgreSQL - IN operator4 min readPostgreSQL - HAVING clause4 min readPostgreSQL - GROUP BY clause4 min readPostgreSQL - LIKE operator5 min readPostgreSQL - BETWEEN Operator3 min readTable OperationsPostgreSQL - CREATE TABLE5 min readPostgreSQL - SELECT INTO4 min readPostgreSQL - CREATE SEQUENCE4 min readPostgreSQL - ALTER TABLE6 min readPostgreSQL - ADD COLUMN4 min readPostgreSQL - DROP COLUMN2 min readPostgreSQL - Rename Table2 min readPostgreSQL - DROP TABLE5 min readPostgreSQL - TRUNCATE TABLE4 min readPostgreSQL - Copy a Table3 min readPostgreSQL - Comparing Tables3 min readPostgreSQL - Show Tables4 min readModifying DataPostgreSQL - INSERT4 min readPostgreSQL - Insert Multiple Values in Various Rows3 min readPostgreSQL UPDATE Statement5 min readPostgreSQL - DELETE4 min readPostgreSQL - Upsert4 min readConditionalsPostgreSQL - CASE3 min readPostgreSQL COALESCE5 min readPostgreSQL - NULLIF() Function4 min readPostgreSQL - CAST3 min readControl FlowPostgreSQL - IF Statement5 min readPostgreSQL - CASE Statement4 min readPostgreSQL - Loop Statement3 min readPostgreSQL - While Loops4 min readPostgreSQL - Exit Statement3 min readPostgreSQL - Continue3 min readTransactions & ConstraintsPostgreSQL - Transactions4 min readPostgreSQL - COMMIT4 min readPostgreSQL - Primary Key4 min readPostgreSQL - Foreign Key5 min readPostgreSQL - CHECK Constraint2 min readPostgreSQL - UNIQUE Constraint3 min readPostgreSQL - NOT NULL Constraint3 min readJOINS & SchemasPostgreSQL - Joins5 min readPostgreSQL - LEFT JOIN5 min readPostgreSQL - INNER JOIN2 min readPostgreSQL - FULL OUTER JOIN4 min readPostgreSQL - SELF JOIN4 min readPostgreSQL - Schema5 min readPostgreSQL - CREATE SCHEMA5 min readPostgreSQL - DROP SCHEMA4 min readPostgreSQL - ALTER SCHEMA3 min read Like