Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tuning query

Status
Not open for further replies.

bheemsen

Programmer
May 9, 2002
22
US
Hi,

Does any one see any improvements that can be made to the following queries. They are taking a long time.

Query #1:
SELECT a.wire_center, a.wire_center_name, a.terminal_name, street_num, street_name, unit, floor, building, a.id, living_unit_id, community, state_cd
FROM lead_seq_lu_address a left outer join lead_seq_taper_da b ON a.terminal_name=b.terminal_name and a.wire_center=b.wire_center
WHERE a.wire_center=@v_wire_center and b.terminal_name is NULL ORDER BY a.terminal_name

Query #2:
SELECT @v_ls_override_terminal_name = override_terminal_name, @v_ls_override_street_num = override_street_num, @v_ls_override_street_name = override_street_name, @v_ls_override_living_unit_id = override_living_unit_id, @v_ls_override_state_cd = override_state_cd
FROM LOAD_ERROR_LU_ADDRESS
WHERE wire_center=@v_lslu_wire_center AND
( (terminal_name = @v_lslu_terminal_name) OR
( (terminal_name IS NULL) AND
(@v_lslu_terminal_name IS NULL) ) ) AND
( (living_unit_id = @v_lslu_living_unit_id) OR
( ( living_unit_id IS NULL) AND
( @v_lslu_living_unit_id IS NULL) ) ) AND
( (state_cd = @v_lslu_state_cd)OR ( ( state_cd IS NULL) AND ( @v_lslu_state_cd IS NULL) ) )


Thanx and I appreciate your inputs.

-Bheem
 
The queries seem simple enough. Are the tables indexed on the columns used in the WHERE and ON clauses? Have the tables been reindexed recently? Are statistics up-to-date? Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top