# [Usage](../../../../usage.md) > [Components](../../basics.md) > [Visuals](../../basics.md) > [Table](../table.md) > query

### `query` | `->setQuery()`
If provided, `values` will be ignored, and the table becomes a dynamic table (server side). All the filtering, searching and sortering is done in back-end. Using this option with pagination will greatly reduce the quantity of data loaded and the swiftness of the table. Using `query` is necessary to enable action buttons for each record, because they inherit the `$record` itself.

| Types       | Default |
|-------------|---------|
| `::query()` | `null`  |

Static (`values`) vs dynamic (`query`): without `setQuery()` the table renders the given `values` array client-side. With `setQuery()` the `values` are ignored and every search, sort, filter and page is resolved server-side in `TableHelper::getTableData()` from the cached query (`table_query_{uuid}`).

Minimal working example — Blade:
```php
{!!
    \KFramework\Components\Visual\Table::make()
        ->setSchema([
            \KFramework\Components\Visual\TableColumn::make('name')->setLabel('Name'),
            \KFramework\Components\Visual\TableColumn::make('email')->setLabel('Email'),
        ])
        ->setQuery($usersQuery)
!!}
```
Controller:
```php
Table::make()
    ->setSchema([
        TableColumn::make('name')->setLabel('Name'),
        TableColumn::make('email')->setLabel('Email'),
    ])
    ->setQuery(User::query());
```
What the user sees: a server-side table; only the current page is loaded, and searching/sorting re-queries the back-end instead of filtering in the browser.

Interaction:
- Pairs with [pageable](table_pageable.md) + [poll](table_polling.md): the classic dynamic-table trio (paginate server-side, auto-refresh every N ms).
- Required for [buttons](table_buttons.md), [selectable schema](table_selectableschema.md) and [accordable schema](table_accordableschema.md), which all need a `$record` from the query.
- Enables [custom filters](table_customfilters.md) and [custom search](table_customsearch.md), which manipulate this same cached query.

See also: [Table](../table.md), [Components basics](../../basics.md), [pageable](table_pageable.md), [buttons](table_buttons.md).