---
title: All
description: Search all rows in the index
canonical: https://www.paradedb.com/docs/documentation/query-builder/compound/all
---

The all query means "search all rows in the index."

The primary use case for the all query is to force the query to be executed by the ParadeDB index instead of Postgres' other execution methods.
Because ParadeDB executes a query only when a ParadeDB operator is present in the query, the all query injects an operator into the query
without changing the query's meaning.

To use it, pass the [key field](/documentation/indexing/create-index#choosing-a-key-field) to the left-hand side of `@@@` and `pdb.all()` to the right-hand side.

<CodeGroup>
```sql SQL
-- Top K executed by standard Postgres
SELECT id, description, rating, category
FROM mock_items
WHERE rating IS NOT NULL
ORDER BY rating
LIMIT 5;

-- Top K executed by ParadeDB
SELECT id, description, rating, category
FROM mock_items
WHERE rating IS NOT NULL AND id @@@ pdb.all()
ORDER BY rating
LIMIT 5;
```

```ts Drizzle
import { and, isNotNull } from "drizzle-orm";
import { search } from "@paradedb/drizzle-paradedb";

// Top K executed by standard Postgres
await db
  .select({
    id: mockItems.id,
    description: mockItems.description,
    rating: mockItems.rating,
    category: mockItems.category,
  })
  .from(mockItems)
  .where(isNotNull(mockItems.rating))
  .orderBy(mockItems.rating)
  .limit(5);

// Top K executed by ParadeDB
await db
  .select({
    id: mockItems.id,
    description: mockItems.description,
    rating: mockItems.rating,
    category: mockItems.category,
  })
  .from(mockItems)
  .where(and(isNotNull(mockItems.rating), search.all(mockItems.id)))
  .orderBy(mockItems.rating)
  .limit(5);
```

```python Django
from paradedb import All, ParadeDB

# Top K executed by standard Postgres
MockItem.objects.filter(
    rating__isnull=False
).order_by('rating')[:5]

# Top K executed by ParadeDB
MockItem.objects.filter(
    rating__isnull=False,
    id=ParadeDB(All())
).order_by('rating')[:5]
```

```python SQLAlchemy
from sqlalchemy import select
from sqlalchemy.orm import Session
from paradedb.sqlalchemy import search

standard_topn_stmt = (
    select(MockItem.id, MockItem.description, MockItem.rating, MockItem.category)
    .where(MockItem.rating.is_not(None))
    .order_by(MockItem.rating)
    .limit(5)
)

paradedb_topn_stmt = (
    select(MockItem.id, MockItem.description, MockItem.rating, MockItem.category)
    .where(MockItem.rating.is_not(None), search.all(MockItem.id))
    .order_by(MockItem.rating)
    .limit(5)
)

with Session(engine) as session:
    {
        "standard_rows": session.execute(standard_topn_stmt).all(),
        "paradedb_rows": session.execute(paradedb_topn_stmt).all(),
    }
```

```ruby Rails
# Top K executed by standard Postgres
MockItem.where.not(rating: nil).order(:rating).limit(5)

# Top K executed by ParadeDB
MockItem.search(:id)
        .match_all
        .where.not(rating: nil)
        .order(:rating)
        .limit(5)
```

```cs EF Core
// Top K executed by standard Postgres
await dbContext
    .MockItems.Where(item => item.Rating != null)
    .OrderBy(item => item.Rating)
    .Take(5)
    .ToListAsync();

// Top K executed by ParadeDB
await dbContext
    .MockItems.Where(item => item.Rating != null && EF.Functions.All(item.Id))
    .OrderBy(item => item.Rating)
    .Take(5)
    .ToListAsync();
```

</CodeGroup>

This is useful for cases where queries that don't contain a ParadeDB operator can be more efficiently executed by ParadeDB vs. standard Postgres,
like [Top K](/documentation/sorting/topk) or [aggregate](/documentation/aggregates/overview) queries.
