**Source URL:** https://general.veevavault.dev/vql/clauses/maxrows.md

# MAXROWS



In v20.3+, use the `MAXROWS` clause to retrieve a maximum of N results, applied after any filters.

## Syntax {#Syntax}

```
SELECT {fields}
FROM {query target}
MAXROWS {number}

```

## Query Examples {#Query_Examples}

The following are examples of queries using `MAXROWS`.

### Query: Retrieve a Maximum of N Documents {#Query_Retrieve_a_Maximum_of_N_Documents}

The following query returns a maximum of 500 documents:

```
SELECT id
FROM documents
MAXROWS 500

```

### Query: Use MAXROWS with PAGESIZE {#Query_Use_MAXROWS_with_PAGESIZE}

When used with the [`PAGESIZE` clause](/vql/clauses/pagesize), the `MAXROWS` clause must come first. The following query returns a maximum total of three (3) documents with one (1) result per page:

```
SELECT username__sys
FROM user__sys
MAXROWS 3
PAGESIZE 1

```


---

**Previous:** [ORDER BY](/vql/clauses/order-by)  
**Next:** [SKIP](/vql/clauses/skip)