小编Swa*_*dit的帖子

提高查询从View中获取数据的性能

我有一个SQL查询,它只从View中获取一条记录.我的观点由很多功能组成.它返回了大约60,000条记录.我想从这个视图中获取的最高记录是8-9秒.如何优化我的视图,以便最多1-2秒.这是我的视图和SQL查询.请帮忙!任何建议都会令人感激.提前致谢.

CREATE View dbo.OMOrderPrePaymentINT    
As    

select   
   dbo.int_payment_customer_number_out('','OMOrderPaymentMasterINT',payment_id)  
   as customer_number,    
   dbo.int_customer_name_out('','OMOrderPaymentMasterINT',payment_id)     
   as customer_name,    
   dbo.int_FormatDate('','OMOrderPaymentMasterINT',document_date)      
   as payment_date,    
   dbo.int_payment_amount_out('','OMOrderPaymentMasterINT',document_amount)   
   as payment_amount,    
   dbo.int_checkbook_id_out('','OMOrderPaymentMasterINT',null)                         
   as checkbook_id,    
   dbo.int_cheque_number_out('','OMOrderPaymentMasterINT',payment_id)     
   as cheque_number,    
   dbo.int_cc_type_out ('','OMOrderPaymentMasterINT',payment_id)      
   as cc_type,    
   dbo.int_cc_number_out('','OMOrderPaymentMasterINT',payment_id)      
   as cc_number,    
   dbo.int_cc_authcode_out('','OMOrderPaymentMasterINT',payment_id)     
   as cc_authcode,    
   dbo.int_ach_account_type_out('','OMOrderPaymentMasterINT',payment_id)    
   as ach_account_type,    
   dbo.int_ach_account_number_out('','OMOrderPaymentMasterINT',payment_id)    
   as ach_account_number,    
   dbo.int_ach_authcode_out('','OMOrderPaymentMasterINT',payment_id)     
   as ach_authcode,    
   dbo.int_expiration_date_out('','OMOrderPaymentMasterINT',payment_id)    
   as creditcard_expiration_date,    
   dbo.int_order_payment_type_out('','OMOrderPaymentMasterINT',payment_id)          
   as payment_type,    
   dbo.int_payment_method_out('','OMOrderPaymentMasterINT',payment_id)     
   as payment_method,    
   dbo.int_erp_payment_action_out('','OMOrderPaymentMasterINT',null)     
   as [action],    
   dbo.int_modified_user_id_out('','',null)           
   as modified_user_id,    
   'NOT MAPPED'                  
   as void_date,    
   export_completed                 
   as exportcompleted,    
   dbo.int_ordergroup_id_out('','OMOrderPaymentMasterINT',payment_id)     
   as ordergroup_id,    
   'ECOM'                    
   as USRDEFND1,    
   dbo.int_ResponseToken_out('','OMOrderPaymentMasterINT',payment_id)     
   as USRDEFND4,    
   dbo.int_transaction_id_out('','OMOrderPaymentMasterINT',payment_id)     
   as USRDEFND5  
from PaymentLine 
where …
Run Code Online (Sandbox Code Playgroud)

sql sql-server view

3
推荐指数
1
解决办法
186
查看次数

标签 统计

sql ×1

sql-server ×1

view ×1