简体   繁体   中英

How to reduce the execution time in stored procedure using mysql

i am working on asp.net3.5 and mysql, now my problem is search page enter the text click the search button fetch the records and bind the gridview , it taking more time(like 1min) but i can reduce the execution time how it possible in front end or back end please give me any idea about that.

thanking u hemanth

For tuning the performance of a SP we need to know how much resources it is using and how much time it takes in execution.

1) Look the queries performence using Execution Plan. After find the Queries, just check the Index(for table used in query) and look the join conditions between tables in the query. - This is way we need to approch to tune the SP.

2) we need to use tablename with (nolock) in our select statements so that it does not create delay if other person is updating the table at the same time it will show last updated table recordset

3) if we dont need that much the database server to return the number of records affected after executing any dml statements which actually reduces the performance ,we can use set nocount on -set nocount off before and after writing the sql query,

4) we can create lesser join statements if we can use subqueries

  • Try getting lesser values on front end.
  • Try getting them using AJAX which are Ajax benifit
  • Try optimizing your SQL QUERY

This link will guide how Store Procedure Reduces Time

Without any sample code, there's not much we can work on. But since you asked for ideas ...

I can think of two possible reasons why your page loads slow:

  1. SQL side of things - Teez basically said what needs to be said.
  2. Display of results - How are you binding to the gridview? Are there extra database calls when you're binding? Are you performing pagination? How?

You can improve performance by optimizing your query.

  • Select only relevant columns instead of select *

  • Use Join if large number of records are there other wise use sub query (For such cases)

Query Optimization

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM