cancel
Showing results for 
Search instead for 
Did you mean: 

table and record count within a HANA schema

Former Member
0 Kudos

hi

I am trying to find out the number of tables and records within a schema for a HANA database, would anyone please advice on how to get them.

Thank you

Jonu

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member182302
Active Contributor

Hello Joy,

SELECT  "TABLE_NAME","RECORD_COUNT"

FROM "SYS"."M_TABLES" WHERE SCHEMA_NAME = '<YOURSCHEMANAME>'

Regards,

Krishna Tangudu

Former Member
0 Kudos

Thx krisha, the results are limited to 1000 , how can we get the total count.

  "TABLE_NAME","RECORD_COUNT","SCHEMA_NAME"


"SYS"."M_TABLES" where "SCHEMA_NAME" = 'SAP'

Former Member
0 Kudos

This is because HANA Studio limits the result sets by default.. You can change this in Preferences -> SAP HANA -> Runtime -> Result and increase it past 1000.


Alternatively you can run the SQL from hdbsql or some other tool that doesn't limit output. Hope this helps.

You might also try:

SELECT  "TABLE_NAME","RECORD_COUNT"

FROM "SYS"."M_TABLES" WHERE SCHEMA_NAME = '<YOURSCHEMANAME>' ORDER BY "RECORD_COUNT" DESC;

So you get the tables with the most rows first.

John

rainer_winkler
Contributor
0 Kudos

Hi Jonu,

to count the tables you should perform:

select count(*) from m_tables where schema_name = '<YOURSCHEMANAME>'

The sum of all records for all tables in the schema is given by (If that makes sense):

select sum( RECORD_COUNT )  from m_tables where schema_name = 'WINKLERR'

With kind regards

Rainer

Former Member
0 Kudos

This message was moderated.