求可获取所有计算视图名称及其行数的SQL查询语句
Get Calculation View Names and Row Counts in SAP HANA
Got it! Since you're working with SAP HANA (evidenced by your use of SYS.M_TABLES for tables), here's a SQL query that mirrors your existing table query but targets calculation views:
SELECT CV.VIEW_NAME AS CALC_VIEW_NAME, CS.RECORD_COUNT FROM SYS.M_CALC_VIEWS CV INNER JOIN SYS.M_CS_TABLES CS ON CV.SCHEMA_NAME = CS.SCHEMA_NAME AND CV.VIEW_NAME = CS.TABLE_NAME WHERE CV.SCHEMA_NAME = 'YOUR_SCHEMA_NAME'; -- Replace with your actual schema name
Key Details:
SYS.M_CALC_VIEWSis the system view dedicated to storing metadata for calculation views, including their names and associated schemas.SYS.M_CS_TABLESprovides statistics for column store objects—this is where we pull theRECORD_COUNTvalue, just like you do for tables inSYS.M_TABLES.- If your row counts look outdated, refresh the statistics first with this command:
UPDATE STATISTICS ON SCHEMA YOUR_SCHEMA_NAME; - If you ever need to include all view types (not just calculation views), swap
SYS.M_CALC_VIEWSwithSYS.M_VIEWSin the query.
内容的提问来源于stack exchange,提问作者Gaurav Meshram
相关产品推荐
相关产品推荐

