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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Into - can it work faster

Status
Not open for further replies.

rtdvoip

Programmer
Aug 29, 2003
27
US
Is there anyway for this to be enhanced so that such a query will run faster in SQL?

----code below----

Insert Into bt_tmp(Clarent_pin,
service_code,
duration,
bill_type,
phone_number,
start_time,
disconnect_reason,
extended_reason_code,
ip_addr_egress,
ip_addr_ingress,
new_call_id,
dest_gateway_id,
source_gateway_id)
Select pin,
service_code,
duration,
bill_type,
phone_number,
start_time,
disconnect_reason,
extended_reason_code,
ip_addr_egress,
ip_addr_ingress,
new_call_id,
dest_gateway_id,
source_gateway_id
from Subscriber.GWUser.Billing_record
where pin in ('dadenegar01','pri','2515436094') and service_code not in ('A','C')
-------code complete-----------------
 
The thing that you will need to optimise is

where pin in ('dadenegar01','pri','2515436094') and service_code not in ('A','C')

is there an index on pin? If not and it wouldn't cause other problems try adding one (depends on your data distribution as to whether it's useful)
If so check that it is being used - if not try updating statistics. If still no then try it with a hint.
If it's still not faster then there is probably not a lot you can do. You could try turning this into a union query but I doubt if it would help.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top