Show Gene..." /> Show Gene..." /> Show Gene..."/>

2 Generated SQL/MDX queries under a SQL query in IBM Cognos

1k Views Asked by At

I have a report where a query named "Query1" is created using the default data items present in the package. When I look into the Tools ---> Show Generated SQL/MDX, IBM Cognos shows 2 generated Native SQL queries for the query named "Query1". How does 2 query get created --- Query1.0 & Query 1.1 ? Under what scenario does this happen? FYI --- The changes that is done in the environment is that a new model is added under a product family at the starting of this month. Could this be the reason why 2 SQL queries has been generated? Can someone explain what happens at the backend?

1

There are 1 best solutions below

2
On

Generally, there are two reasons that you will see multiple separate queries in the generated SQL:

  1. Some or all of the objects referenced in the Cognos query don't have defined relationships to each other in the model/package
  2. The objects referenced in the Cognos query come from two or more different data sources

In the case of 1 you will end up with a cross join. In the case of 2, Cognos will retrieve the data separately from each source and then stitch them together in memory on the Cognos report server.

There may be other reasons that more than one separate query is shown in generated SQL but these two are the ones I've come across in my work.