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

# Table Statistics

> Returns statistical metadata for the specified table. Includes per-column `distinctFraction` values, which represent the estimated fraction of distinct values in a column relative to the total row count. These statistics are used internally by Peaka's query optimizer to improve query planning and execution performance.

<span style={{display: "flex", gap: "10px", flexDirection: "row", alignItems: "center"}}>
  <img src="https://cdn.peaka.com/badges/partner-api-key-badge.png" />

  <img src="https://cdn.peaka.com/badges/project-api-key-badge.png" />
</span>


## OpenAPI

````yaml get /data/projects/{projectId}/catalogs/{catalogId}/schemas/{schemaName}/tables/{tableName}/statistics
openapi: 3.0.1
info:
  title: Peaka Gateway API
  description: Peaka Gateway API Documentation
  version: '1.0'
servers:
  - url: https://partner.peaka.studio/api/v1
    description: Default Server URL (US Zone)
  - url: https://partner.eu.peaka.studio/api/v1
    description: EU Zone
security:
  - bearerAuth: []
paths:
  /data/projects/{projectId}/catalogs/{catalogId}/schemas/{schemaName}/tables/{tableName}/statistics:
    get:
      tags:
        - Data -- Catalogs
      summary: Table Statistics
      description: >-
        Returns statistical metadata for the specified table. Includes
        per-column `distinctFraction` values, which represent the estimated
        fraction of distinct values in a column relative to the total row count.
        These statistics are used internally by Peaka's query optimizer to
        improve query planning and execution performance.
      operationId: getTableStatistics
      parameters:
        - name: projectId
          in: path
          description: ID of the project
          required: true
          schema:
            type: string
          example: mtKDhe1U
        - name: catalogId
          in: path
          description: ID of the catalog
          required: true
          schema:
            type: string
          example: 846085284821991600
        - name: schemaName
          in: path
          description: Name of the schema
          required: true
          schema:
            type: string
          example: public
        - name: tableName
          in: path
          description: Name of the table
          required: true
          schema:
            type: string
          example: actor
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TableStatistics'
              examples:
                Table Statistics:
                  description: Table Statistics
                  value:
                    catalogId: '846085284821991568'
                    schemaName: public
                    tableName: actor
                    columnStatistics:
                      - columnName: actor_id
                        distinctFraction: -1
                      - columnName: first_name
                        distinctFraction: -0.64
                      - columnName: last_name
                        distinctFraction: -0.605
                      - columnName: last_update
                        distinctFraction: 1
components:
  schemas:
    TableStatistics:
      type: object
      properties:
        catalogId:
          type: string
          description: The ID of the catalog.
        schemaName:
          type: string
          description: The name of the schema.
        tableName:
          type: string
          description: The name of the table.
        columnStatistics:
          type: array
          description: Statistics for each column in the table.
          items:
            $ref: '#/components/schemas/ColumnStatistics'
    ColumnStatistics:
      type: object
      properties:
        columnName:
          type: string
          description: The name of the column.
        distinctFraction:
          type: number
          description: >-
            The estimated fraction of distinct values in a column compared to
            the total number of rows in the table. It helps in query
            optimization, statistics collection, and cardinality estimation in
            database systems.
          format: double
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        Use the Authorization header with the value 'Bearer <apiKey>' to
        authenticate. Partner API Keys have full access; Project API Keys are
        limited to their project scope. Learn more:
        https://docs.peaka.com/api-reference/authentication
      scheme: bearer
      bearerFormat: Api Key

````