Spatial Analysis in 2025: Key Trends Report
| Download Now
CARTO
Platform
Overview
Visualization
Analytics
App Development
Data Enrichment
AI Agents
Enterprise & Security
Pricing
CARTO for
Google Cloud
AWS
Azure
Snowflake
Databricks
Oracle
Solutions
By Industry
By Use Case
By Role
Telecoms
Icon/indus/Insurance-menu
Icon/indus/Insurance-menu-mobile
Insurance
Logistics
Real Estate
Financial Services
Retail
Marketing & Advertising
Mobility
All industries
Network Deployment
Catastrophe Modeling
Fraud Detection
Market Analysis
Environmental Management
Site Selection
Geomarketing
Data Monetization
IoT Analytics
Supply Chain Optimization
Healthcare Analytics
Territory Planning
All use cases
Data Analyst
Data Scientist
GIS Professional
Developer
Customers
Resources
Learn
Documentation
CARTO Academy
Blog
Reports
Glossary
Connect
Events
Partners
Webinars
Log inRequest a demo
Try for free
2050-01-01
1990-01-01
"ES", "GB"

This content applies to a previous version of CARTO

In October 2021 we released a new version of our platform. You can find the latest documentation at docs.carto.com

Back to Help Center

How to Find the Size of a Dataset

Learn how to use PostgreSQL to find the exact size of a dataset in your CARTO account.

Overview

The Datasets Dashboard provides a size estimate for datasets, but this doesn’t account for additional system elements. PostgreSQL enables you to determine the precise size including TOAST tables and indexes.

Quick Query

To find the total size of a dataset, open it from your Datasets Dashboard, switch to SQL mode, and run:

SELECT pg_size_pretty (pg_total_relation_size('your_dataset_name'))

Detailed Breakdown Query

For a comprehensive size analysis, use this query. Replace your_account_name_or_public with your account name (Enterprise clients) or 'public' (others):

SELECT table_name,
        row_estimate,
        pg_size_pretty(total_bytes) AS total_size,
        pg_size_pretty(index_bytes) AS index_size,
        pg_size_pretty(toast_bytes) AS toast_size,
        pg_size_pretty(table_bytes) AS dataset_size
FROM (
  SELECT *,
          total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes
  FROM (
    SELECT c.oid,
            nspname AS table_schema,
            relname AS table_name,
            c.reltuples AS row_estimate,
            pg_total_relation_size(c.oid) AS total_bytes,
            pg_indexes_size(c.oid) AS index_bytes,
            pg_total_relation_size(reltoastrelid) AS toast_bytes
    FROM pg_class c
    LEFT JOIN pg_namespace n
    ON n.oid = c.relnamespace
    WHERE relkind = 'r'
    AND nspname like 'your_account_name_or_public'
    AND relname = 'your_dataset_name'
  ) a
) a
ORDER BY total_bytes DESC

Results

This query returns a data view displaying:

  • Dataset name and row count
  • Original dataset size
  • Index size
  • TOAST size
  • Total size (all components combined)
CARTO
carto-logo
  • Platform

  • Overview

  • Visualization

  • Analytics

  • App Development

  • Data Enrichment

  • Security & Governance

  • Gen AI

  • Pricing

  • Solutions

  • Data Analyst

  • Developer

  • Data Scientist

  • GIS Professional

  • By Industry

  • By Use Case

  • Resources

  • Customer Stories

  • Blog

  • Glossary

  • Documentation

  • Academy

  • Reports

  • Events

  • Webinars

  • Partners

  • Company

  • About us

  • Newsroom

  • Careers

  • Brand

  • Grants

Unlock the power of spatial analysis.

youtube logofacebook logotwitter logolinkedin logo

© CARTO 2024

Terms

Privacy Notice

Whistleblower Form