Performance of SQL code

106 views Asked by At

I have SQL queries like the one below, I have many others also and at the moment we are experiencing a long time delay to run these queries as part of reports.

Does anyone know how to performance tune these to run much better and quicker this could be some program you could put the code in to and it does performance tune them, or specific things I should look to avoid doing.

I have done these in SQL developer before placing them in the reporting software. however I can not see any additional add on with on SQL developer

SELECT o.wh_id,
  o.bill_to_code,
  (
  CASE
    WHEN d.pick_area LIKE 'GPS%'
    THEN 'GPS'
    ELSE d.pick_area
  END)     AS pick_area,
  COUNT(*) AS Amount_of_picks
FROM t_order o
INNER JOIN t_pick_detail d
ON o.order_number = d.order_number
WHERE o.wh_id     = '~wh_id~'
AND TRUNC(d.create_date) BETWEEN dbo.usf_format_date_to_glb_locale('~WW_USERLCID~','~DateFrom~') AND dbo.usf_format_date_to_glb_locale('~WW_USERLCID~','~DateTo~')
GROUP BY o.wh_id,
  o.bill_to_code,
  (
  CASE
    WHEN d.pick_area LIKE 'GPS%'
    THEN 'GPS'
    ELSE d.pick_area
  END)
ORDER BY o.bill_to_code
;

Many thanks

0

There are 0 answers