Quantcast
Channel: SCN : Discussion List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 5653

When to Use Inverted Keys

$
0
0

We had some tables that were really large and using a lot of space. (The tables were already partitioned btw)

 

On a deeper dive we see that the tables internal object sizes were larger than the tables themselves. The tables had multiple keys and we saw those keys were large.

 

We changed those tables to inverted hashes ( I believe we did 4 tables ) and the size of those internal objects decreased. We didn't see any noticeable degradation of sql performance..

 

So ... we are looking to establish criteria for when we want to use inverted hashes.

 

I ran this qry:

 

select distinct a.schema_name,a.table_name, a.columns, a.internal, a.internalPK, b.record_count
from
(
select schema_name, table_name,
sum(case when my_type = 'columns' then memory end) as columns,
sum(case when my_type = 'internal' then memory end) as internal,
sum(case when my_type = 'internalPK' then memory end) as internalPK
from
(
--M_CS_COLUMNS - Runtime information of columns of column tables
select schema_name, table_name, 'columns' as my_type, memory
from
(
select schema_name, table_name,  sum(memory_size_in_total) as memory
from sys.m_cs_columns
group by schema_name, table_name
)
union
--M_CS_ALL_COLUMNS - Runtime information from all columns of column tables, including internal ones
select schema_name, table_name, 'internal' as my_type, memory
from
(
select schema_name, table_name, sum(memory_size_in_total) memory
from sys.m_cs_all_columns
group by schema_name,table_name
)
union
select schema_name, table_name, 'internalPK' as my_type, memory
from
(
select schema_name, table_name, sum(memory_size_in_total) memory
from sys.m_cs_all_columns
where column_name='$trexexternalkey$'
group by schema_name, table_name
)
)
where memory > 0
group by schema_name, table_name
) as a left join sys.m_cs_tables as b on a.schema_name=b.schema_name and a.table_name=b.table_name
where a.internalPK > a.columns
order by 1

 

and it produced the following:

inverted_key.jpg

So you can see that when the internalPK is greater than the size of the columns then it *could* be a candidate.

 

Anyone have some other criteria? 2,951,038,304 is about 3 Gb.

 

So maybe we shouldn't get concerned until the size is over 20 GB? Comments?

 

Mike


Viewing all articles
Browse latest Browse all 5653

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>