Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

jrdunson
Contributor

Does Autonumber work with SQL Union Statement?

I'm trying to use the Autonumber() function to remove the Symbol width... for performance tuning.

However it's not working...

Background, we are adding tables together via an SQL union

1. The first table uses 'gkey' as primary key (about 2,000,000 rows)

2  The secondary table uses 'dkey' as 'gkey'  as the primary key [but we add 9 Trillion to the dkey, to avoid any overlapping, duplicate keys:  so 561,930 becomes 9,000,000,561,930...so after the union, all the keys are still distinct, howbeit there is a large gap between keys from different tables]

My question is... can I use autonumber with an SQL Union statement?  Could the SQL union be causing the problem?

Here is my Load statement, and SQL Union statement....

Table1:

LOAD

  Autonumber(gkey,'gkey') AS [Primary Gkey],

  [other fields],

  ...

;

SQL

Select

  gkey,

  [other fields],

  ...etc.

UNION

Select

  dkey as gkey.

  [other fields],

  ...etc.

;

Here is my current size (in Rob Wunderlich's Document Analyzer):

Distinct Values    Symbol Width    ~ "Symbol Bytes"

2,214,889           8.00                     19,934,001

1 Solution

Accepted Solutions
Employee
Employee

Re: Does Autonumber work with SQL Union Statement?

Yes you can, autonumber and union work in differente levels (QlikView x SQL )

6 Replies
Employee
Employee

Re: Does Autonumber work with SQL Union Statement?

Yes you can, autonumber and union work in differente levels (QlikView x SQL )

MVP
MVP

Re: Does Autonumber work with SQL Union Statement?

However it's not working...


could you explain the problem?

syntax error? wrong result?

jrdunson
Contributor

Re: Does Autonumber work with SQL Union Statement?

Thanks Clever,

However, I'm not sure, why, after I use autonumber doesn't reduce my Symbol Width to ) (.e.g. Sequential numbers occupy zero Symbol storage... the state table used as proxy).   Shouldn't my Symbol width be 0 ?

jrdunson
Contributor

Re: Does Autonumber work with SQL Union Statement?

Sequential numbers should occupy zero Symbol storage... I should get this: 

Distinct Values Symbol Width "Symbol Bytes"

2,214,889           0           2,214,889

Not this...

Distinct Values Symbol Width "Symbol Bytes"

2,214,889           8.00           19,934,001

Employee
Employee

Re: Does Autonumber work with SQL Union Statement?

I´m sure about sequential numbers requiring 0 bytes,

Symbol Tables and Bit-Stuffed Pointers

Employee
Employee

Re: Does Autonumber work with SQL Union Statement?

I think you´ll need 22 bits to represent up to  4.194.304 different values

21 bits would store only  2.097.152 different values

Community Browser