How can we retrieve the size of a table in Redshift, for example when the table is about one gigabyte, and what options should we consider?
💡 Model Answer
In Redshift you can use system views to get table size. The most common is SVV_TABLE_INFO, which returns size in bytes, rows, and other metadata. For example: SELECT tablename, size, rows FROM SVV_TABLE_INFO WHERE tablename = 'my_table'; The size column is in bytes, so divide by 1,073,741,824 to get GB. Another option is to use the pg_table_size function: SELECT pg_table_size('my_schema.my_table'); This returns the size of the table’s data. If you need the total size including indexes and TOAST, use pg_total_relation_size. For a one‑gigabyte table, you might also consider using the ANALYZE command to update statistics, which helps the query planner estimate costs. If the table is large, you can partition it by adding a sort key or using a distribution style that reduces data movement. Finally, if you need to monitor growth over time, you can schedule a query that logs the size to a monitoring table or use CloudWatch metrics via Redshift’s integration.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.
Get Assisting AI — Starts at ₹500