> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Why is `system.parts` empty for a user that has `SELECT` on it?

> Rows of system.parts, system.tables and other system tables are filtered by SHOW privileges, so a SELECT grant on the system table alone returns an empty result.

`GRANT SELECT ON system.parts` allows a user to query the table, but the table returns only the rows that describe tables the user is allowed to see. A user without the `SHOW TABLES` privilege on those tables gets an empty result and no error. Grant `SHOW TABLES` (or any other privilege) on the tables whose parts the user needs to see.

## Example

As an administrator, create a table and a user that can read `system.parts`:

```sql theme={null}
CREATE DATABASE db1;

CREATE TABLE db1.events
(
    id UInt64,
    message String
)
ENGINE = MergeTree
ORDER BY id;

INSERT INTO db1.events SELECT number, 'event' FROM numbers(1000);

CREATE USER monitoring IDENTIFIED WITH sha256_password BY '<password>';

GRANT SELECT ON system.parts TO monitoring;
```

Connect as `monitoring` and run:

```sql theme={null}
SELECT database, table, name, rows
FROM system.parts
WHERE active;
```

The query succeeds and returns no rows. Now, as the administrator, add the missing privilege:

```sql theme={null}
GRANT SHOW TABLES ON db1.* TO monitoring;
```

The same query, run as `monitoring`, now returns the part:

```text theme={null}
   ┌─database─┬─table──┬─name──────┬─rows─┐
1. │ db1      │ events │ all_1_1_0 │ 1000 │
   └──────────┴────────┴───────────┴──────┘
```

`SHOW TABLES` reveals metadata only. Reading `db1.events` itself is still refused with `ACCESS_DENIED` until you grant `SELECT` on it.

## Why this happens

`system.parts` exposes the names of databases and tables, so it shows a part only if the current user holds the `SHOW TABLES` privilege on the table the part belongs to. The check is made for every table: a user can see the parts of some tables and not of others.

You can grant `SHOW TABLES` on one table, on a database, or on everything:

```sql theme={null}
GRANT SHOW TABLES ON db1.events TO monitoring;
GRANT SHOW TABLES ON db1.* TO monitoring;
GRANT SHOW TABLES ON *.* TO monitoring;
```

A user also has the `SHOW` privileges on an object implicitly when it has any other privilege on it. For example, a user with `SELECT` on `db1.events` sees the parts of `db1.events` without a separate `SHOW TABLES` grant.

## Other system tables that hide rows

The same filtering applies to other system tables that describe databases, tables, columns and dictionaries:

| System tables | Privilege that makes a row visible |
| - | - |
| `system.databases` | `SHOW DATABASES` on the database |
| `system.tables`, `system.detached_tables` | `SHOW TABLES` on the table |
| `system.columns` | `SHOW COLUMNS` on the column |
| `system.dictionaries` | `SHOW DICTIONARIES` on the dictionary |
| `system.parts`, `system.parts_columns`, `system.projection_parts`, `system.projection_parts_columns`, `system.detached_parts`, `system.dropped_tables_parts` | `SHOW TABLES` on the table |
| `system.merges`, `system.moves`, `system.mutations`, `system.replicas`, `system.replication_queue`, `system.replicated_fetches`, `system.distribution_queue` | `SHOW TABLES` on the table |
| `system.data_skipping_indices`, `system.projections` | `SHOW TABLES` on the table |

`SHOW COLUMNS` implies `SHOW TABLES`, and `SHOW TABLES` or `SHOW DICTIONARIES` implies `SHOW DATABASES`. To make all metadata visible to a monitoring user, grant the whole group:

```sql theme={null}
GRANT SHOW ON *.* TO monitoring;
```

`system.databases`, `system.tables` and `system.columns` are readable by every user without a `SELECT` grant, and they are filtered in the same way.

## How to tell a missing `SELECT` grant from hidden rows

With the default [`select_from_system_db_requires_grant`](https://clickhouse.com/docs/reference/settings/server-settings/settings/access-control#access_control_improvements) setting, a missing `SELECT` grant on a system table produces an error, not an empty result:

```text theme={null}
Code: 497. DB::Exception: monitoring: Not enough privileges. To execute this query, it's necessary to have the grant SELECT ON system.merges. (ACCESS_DENIED)
```

If the query succeeds but rows are missing, check the `SHOW` privileges of the user:

```sql theme={null}
SHOW GRANTS FOR monitoring;
```

```text theme={null}
GRANT SHOW TABLES ON db1.* TO monitoring
GRANT SELECT ON system.parts TO monitoring
```

## Related documentation

* [`GRANT`: the `SHOW` privileges](https://clickhouse.com/docs/reference/statements/grant#show)
* [`system.parts`](https://clickhouse.com/docs/reference/system-tables/parts)
* [Access control and account management](https://clickhouse.com/docs/concepts/features/security/access-rights.md)
