Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
552 views
in Technique[技术] by (71.8m points)

hana - How to get SDI replication Virtual tables count with out using select count(*) from "VT_TABLE_NAME"?

My question here is whenever we run select count(*) from table name on huge table taking more time and using some memory when I am running the query.

I want to compare count of virtual table and physical table whether it is matching or not? and real time replication is working fine or not?

I can get physical tables count from

SELECT "TABLE_NAME","RECORD_COUNT","SCHEMA_NAME" FROM "SYS"."M_TABLES"

The problem here is with out using select count(*) from "VT_<Table_name>", How to get the count of all virtual tables from particular schema? Is there any standard table in HANA to get count of virtual tables from particular schema?

or

Any other way to get count with out using count(*) method?

question from:https://stackoverflow.com/questions/65914820/how-to-get-sdi-replication-virtual-tables-count-with-out-using-select-count-f

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Short answer: No, there's no other way.

HANA cannot know the record count in external resource (I think it is applicable to every software), because it has no control on it: it does not know if someone had deleted or inserted new data at remote source to update the record count in its local system table, when for HANA's own tables it can (just include this action in transaction processing).

Moreover, it is possible to have a view as a remote source (maybe table-valued functions are also allowed for some DBMSes since I do not see any difference between any SELECTable objects from consumption point of view), so the logic of consistent rowcounts became very complicated (source database cannot report you the record count in view, because it need to calculate its output first).

Assuming it has that counts locally will cause to run select count(*) from remote_source every N seconds which is waste of resources.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...