Author Topic: issue with cognos SQL  (Read 1081 times)

Offline johny.cbi

  • Community Leader
  • *****
  • Posts: 94
  • Forum Citizenship: +0/-0
issue with cognos SQL
« on: 02 Sep 2010 08:45:55 pm »
issue with cognos SQL

when we are using the  filter by creating a parameter in Report Studio
cognos is generating a cast function by default .  any ideas ?

Thanks for the help
« Last Edit: 02 Sep 2010 09:11:02 pm by johny.cbi »

Offline technomorph

  • Senior Member
  • ****
  • Posts: 70
  • Forum Citizenship: +2/-0
Re: issue with cognos SQL
« Reply #1 on: 02 Sep 2010 09:15:34 pm »
Can you provide a bit more detail. :)

Offline johny.cbi

  • Community Leader
  • *****
  • Posts: 94
  • Forum Citizenship: +0/-0
Re: issue with cognos SQL
« Reply #2 on: 02 Sep 2010 09:31:32 pm »
sample SQL

select "DMND_FRCST"."DMND_CTGRY" "Demand_Category"
from "SPM_BI_SL"."DMND_FRCST_V" "DMND_FRCST"
where "DMND_FRCST"."DMND_CTGRY" = cast(? as char(20))
group by "DMND_FRCST"."DMND_CTGRY"

due to this performance is getting effected for the reports

The above SQL shows Cast in RS where as in Data Base the query runs with out Cast Function
cognos is generating a cast function by default

Offline tupac_rd

  • Statesman
  • ******
  • Posts: 293
  • Forum Citizenship: +9/-0
Re: issue with cognos SQL
« Reply #3 on: 02 Sep 2010 11:10:57 pm »
can you add a database function like to_char(?parameter?), just to rule out cognos doing it... and see if that helps.

Offline johny.cbi

  • Community Leader
  • *****
  • Posts: 94
  • Forum Citizenship: +0/-0
Re: issue with cognos SQL
« Reply #4 on: 02 Sep 2010 11:30:47 pm »

Data Base : Tera Data

to_char doesn't support for Teradata

Offline technomorph

  • Senior Member
  • ****
  • Posts: 70
  • Forum Citizenship: +2/-0
Re: issue with cognos SQL
« Reply #5 on: 03 Sep 2010 02:15:27 am »
I suspect that the cast function is not the cause of your poor performance because it looks to me as though this is the type of SQL generated when using the 'Show MDX/SQL...' menu option. Cognos typically substitutes filter parameters within native SQL to 'cast(? char(20))...' when a parameter value has not been defined i.e. when the report has not been validated.

As a troubleshooting exercise I would suggest hard-coding the filters and then comparing performance. It's probably worth checking the native SQL after this as well.

Cheers

Offline johny.cbi

  • Community Leader
  • *****
  • Posts: 94
  • Forum Citizenship: +0/-0
Re: issue with cognos SQL
« Reply #6 on: 03 Sep 2010 02:49:32 am »
Thanks for your answers. I changed the options in Governor Settings and I don't see Cast function at report level.

Online MFGF

  • Never knowingly correct
  • Super Moderator
  • Statesman
  • ******
  • Posts: 2,908
  • Forum Citizenship: +137/-1
  • Cognos Software Muppet
Re: issue with cognos SQL
« Reply #7 on: 03 Sep 2010 04:50:38 pm »
Thanks for your answers. I changed the options in Governor Settings and I don't see Cast function at report level.

What governor setting did you modify?  As Coggod said above (I love the username, by the way! :) ), cast(? char(20)) is normally only shown for an unidentified parameter value, and would not be translated into the runtime query as the parameter would have been resolved at this point.

MF.
Meep!