on 11-28-2013 10:44 PM
Dear HANA Gurus.
What is faster in HANA for selecting - varchar(9) field or integer field?
With high cardinality values. By example order number.
You need to give more info. Can you give example DDL and queries.
John
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, it's column store
and yes again, nvarchar(9) vs int.
So, who is the winner nvarchar(9) or int?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mikhail,
I would say INT for below reasons:
in INT type we can store numeric data only but in CHAR can be numeric or text.
In CHAR if we are storing the numeric data only and while comparing, it will convert to INT(VARCHAR) which needs additional processing.
Ex: var1 is defined as char(1).
If var1 > 9 then .......
Regards
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raj,
Certainly its an overhead to convert it but I have some thoughts on this.
In such a specific case as you describe where it is being used in a procedure via a variable then wouldn't the variable be converted only once for the procedure run? Which I think should not add by much to the overall time taken for the SELECT and the conversion.
So if the requirement is such to use NVARCHAR or NCHAR, one should not hesitate.
--
Shreepad
Hi Mikhail,
I have not tried this out myself for large data sets.
But as per my understanding of the architecture of HANA if you are using Column Store table both should be same.
As HANA Stores every column table in a format known as Dictionary Encoding. This is pretty complex for me to be explained here. But basically in the background in both the cases the Select will run on a similar Attribute Vector (A kind of list of indices).
If you need details on Dictionary Encoding you may go through the course on In-Memory Architecture available on openhpi.de.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.