Explain the difference between clustered and non-clustered indexing and how they impact query performance at TikTok.
Use PostgreSQL terminology and inspect the catalog metadata to support the explanation. Distinguish PostgreSQL's clustering flag from a continuously maintained clustered index.
video_eventsindex_name, access_method, and clustering_statusindex_name ascending| Column | Type | Description |
|---|---|---|
| indexrelid | OID | OID of the index relation |
| indrelid | OID | OID of the indexed table relation |
| indisclustered | BOOLEAN | Whether the index is marked as the table's clustering index |
| indisvalid | BOOLEAN | Whether the index is valid for query planning |
| Column | Type | Description |
|---|---|---|
| oidPK | OID | Object identifier for the relation |
| relname | NAME | Relation name |
| relkind | CHAR | Relation kind, such as table or index |
| relam | OID | OID of the relation access method |
| Column | Type | Description |
|---|---|---|
| oidPK | OID | Object identifier for the access method |
| amname | NAME | Access method name, such as btree or hash |