Help Center/
GaussDB/
Developer Guide(Distributed_V2.0-3.x)/
SQL Optimization/
Introduction to the SQL Execution Plan/
Operators/
Operators/
Limit
Updated on 2025-03-13 GMT+08:00
Limit
Description
The limit operator limits the number of output execution results. If a limit operator is added, not all rows are retrieved.
Typical Scenarios
Use a query statement containing the keyword limit.
Examples
Example: Use a query statement containing the keyword limit.
-- Prepare data. gaussdb=# DROP TABLE IF EXISTS t1; gaussdb=# CREATE TABLE t1 ( id int, number int); CREATE TABLE gaussdb=# INSERT INTO t1 VALUES (generate_series(1,50), 1); INSERT 0 50 gaussdb=# EXPLAIN SELECT * FROM t1 LIMIT 10 OFFSET 20; QUERY PLAN ------------------------------------------------------------------------------------ Limit (cost=0.00..0.00 rows=1 width=8) -> Data Node Scan on "__REMOTE_LIMIT_QUERY__" (cost=0.00..0.00 rows=1 width=8) Node/s: All datanodes (3 rows) -- Drop. gaussdb=# DROP TABLE t1;
Parent topic: Operators
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot