### Limit
![[assets/ex_limit.png|256]]
### The Explain Trace
```sql
-- Restricting the result set to 10 rows
EXPLAIN (ANALYZE, COSTS, BUFFERS, VERBOSE)
SELECT * FROM animals LIMIT 10;
```
```text
Limit (cost=1.00..1.17 rows=10 width=27) (actual time=1.002..1.003 rows=10 loops=1)
Output: id, name, species_id, created_at
Buffers: shared hit=1
-> Seq Scan on public.animals (...)
```
---
- **Description**: Restricts the number of rows returned.
- **Performance**: High performance; short-circuits the child node once the limit is reached.
- **Factors**: The position of the LIMIT in the plan (earlier is usually better).
- **Cost**: A fractional cost based on the percentage of the input plan scanned.
![[assets/ex_limit.svg|256]]
- **Operates on**: [[Structures/Result Set]]
- **Workloads**:
- [[Workloads/LWLock/Buffers/BufferContent|LWLock: BufferContent]]