Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to ifentify these are synthetic keys ? before developing data model?

how to ifentify these are synthetic keys ? before developing data model?

1 Solution

Accepted Solutions
qlikoqlik
Creator
Creator

Hi Manoj

If the fields are named as same qlikview automatically creates a synthetic key

Thanks and regards

Padma

View solution in original post

19 Replies
qlikoqlik
Creator
Creator

Hi Manoj

If the fields are named as same qlikview automatically creates a synthetic key

Thanks and regards

Padma

Clever_Anjos
Employee
Employee

Easiest way is after you load your data.

Go to Table Viewer (Control+T) and switch to "Internal Table View"

Not applicable
Author

before developing data model i want identify synthetic means not completely just i want undestand these fields will get synthetic key

Not applicable
Author

composite keys in data base source tables can cause synthetic keys in Qlikview.

you can identify the synthetic keys by analyzing source tables and their relationships

Anonymous
Not applicable
Author

When you build the data model on paper, YOU DECIDE (not IDENTIFY) how it will look like - tables, fields, keys, etc.  If YOU DECIDE you want the synthetic keys - so be it.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

A synthetic key is created by QlikView at the end of the load process if there are two or more fields with identical names that exist in two or more tables.  If you look for duplicate field names you will be able to tell before hitting reload whether a synthetic key will be created.

There is much written about synthetic keys on-line and how to deal with them.  Renaming fields with AS, or omitting fields altogether are two ways.  Sometimes it is necessary to build your own composite key (a single field made of two or more parts) to avoid synthetic keys - you need to ensure that all combinations of the constituent parts exist in one of the tables (as they will need to be removed from the other tables).

Alternatively, you could just embrace the fact that composite keys are created and do their job of joining tables with more than two common fields (though I don't subscribe to this myself).

You do need to be careful that you don't have two many fields that are common between two tables - as QlikView can crash at the end of the load if building the synthetic keys takes too long or consumes all of the memory.

Hope that helps,

Steve

Clever_Anjos
Employee
Employee

Every time, two (or more tables) share two or more fields in common, a SK will be generated.

It´s the way QlikView handle composite keys

evan_kurowski
Specialist
Specialist

A method I've used in the past to evaluate the potential for synthetic keys BEFORE incorporating a variety of tables with very large field lists into the application, is to make a table around the metadata itself.

At a minimum, a two column table listing TABLE and FIELD of all the fields you are targeting for a data model should be enough to create a pivot table or list box which illustrates which of your field names are repeating across multiple target source tables.  From there the concept could be expanded to incorporate SCHEMA and ENVIRONMENT but for a simple exercise the TABLE/FIELD combo will be sufficient.  This becomes very useful if your data model could span thousands of distinct fields using potentially repeating names across any number of tables.  What this can also do, is if you are new or unfamiliar to the data model, yield some insight as to which are the likely components of compound keying systems across tables.

20140802_repeating_fields_identified.png

The example in the image above has more than two possible TABLES in selection.  Now if the number of possible tables were reduced to just two, it should produce an exact listing of the synthetic key components between them:

20140802_repeating_fields_identified_between_two_tables.png

Once you have identified a listing of repeating field names from your targeted table list, it becomes a matter of evaluating the repeaters for whether you want to deliberately include synthetic (compound) associations, whether it is time to create single field keys based on combining compound values into a single field, whether aliasing will deactivate the synthetic possibilities, or whether the repeating fields are redundant or unnecessary and can be dropped from the data model altogether

I think we all at one point or another have experienced a script execution that has frozen upon completion, not because the script syntax was invalid in any way, but because the creation of very large synthetic keys consumes the cpu/memory upon completion and freezes the application.  It can either take a very long time to release the script, or the application has to be restarted.  If you have never experienced this, then you can skip this last section.

Even if you've been very diligent about checking for synthetic keys, a safe way to test the data model would be to run the script in the debugger with a zero row reload.  This may allow simulating very large or complicated synthetic key structures without consuming processor or memory.

20140802_set_debugger_as_zero.png

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Evan,

The debug load with no rows and then a quick look in the Table Viewer is a great way to check the model before forcing QlikView to create a massive synthetic key.

You could also use that approach to build your meta data viewer.  Rather than pulling in a separate load (from Sysobjects and Syscolumns in SQL, for instance) you could simply do the Debug load with zero rows, and then use the $Table and $Field objects in the way you demonstrate.

Steve