# Audit schema field types and values by dataset

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Fcookbook%2Faudit_schema_field_type.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Fcookbook%2Faudit_schema_field_type.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

## TL;DR[​](#tldr "Direct link to TL;DR")

Group `system/engine.schema_fields` by dataset, count distinct types with `distinct_count(type)`, and rank datasets by `type_count` to reveal which have the most diverse schemas.

## Problem / Use case[​](#problem--use-case "Direct link to Problem / Use case")

You want to understand how many unique data types exist across your datasets and see which ones contain the greatest type variety. This helps identify inconsistent schemas or areas where normalization is needed.

## Query[​](#query "Direct link to Query")

```
source system/engine.schema_fields

| groupby dataset

    aggregate

        distinct_count(type) as type_count,

        any_value(type) as sample_type

| orderby type_count desc
```

## Expected output[​](#expected-output "Direct link to Expected output")

| dataset               | type\_count | sample\_type |
| --------------------- | ----------- | ------------ |
| logs                  | 13          | object       |
| aaa.audit\_events     | 10          | string       |
| engine.schema\_fields | 8           | null         |
| engine.queries        | 7           | number       |
| spans                 | 6           | string       |
| labs.limitViolations  | 5           | number       |

## Variations[​](#variations "Direct link to Variations")

* Count schema fields by **source system** instead of dataset.
* Include **field count per type** to measure schema complexity within datasets.
