Hi y'all,
Is there a SYSTEM table in Vertica that contains the current row counts for all tables in the database?
Is there a SYSTEM table with row counts?
Moderator: NorbertKrupa
Is there a SYSTEM table with row counts?
Thanks,
Juliette
Juliette
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: Is there a SYSTEM table with row counts?
Hi Juliette,
Of course the simplest way to get a table row count is via the COUNT aggregate function:
Remember that in Vertica that tables do not actually contain data; its their associated projections that do! Therefore, another method is via the ROW_COUNT column of the PROJECTION_STORAGE system table:
Hope this helps!
Of course the simplest way to get a table row count is via the COUNT aggregate function:
Code: Select all
dbadmin=> SELECT COUNT(*) FROM verticadb_wh.date_dim;
COUNT
-------
4752
(1 row)
Code: Select all
dbadmin=> SELECT MAX(row_count) row_count
dbadmin-> FROM projection_storage
dbadmin-> WHERE anchor_table_schema = 'verticadb_wh'
dbadmin-> AND anchor_table_name = 'date_dim';
row_count
-----------
4752
(1 row)
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Re: Is there a SYSTEM table with row counts?
Thank you! I'll create my own view having a column named row_count using your query to populate it!
Thanks,
Juliette
Juliette