Perfomance issues in MVC applciation with Sql Server

22 views Asked by At

I have one concern. I already created Views and I called every view in the EDMX file. Now I have a problem with performance. So, I thought I can remove all views from the edmx file and I will add a Stored procedure. I will call View into a stored procedure. Can it improve the performance?

 public (IList<TableView>, int) Get(Expression<Func<TableView, bool>> expression)
    {
IList<TableView> data = new List<TableView>(); int count = 0;
        using (Container context = new Container())
            {
                var query = context.TableView.Where(expression);
                count  = query.Count();
                query = query.OrderByQuery("Name", "Asc");
                data  = query.Paging(1,15);
                return (data,count);
            }
    }
1

There are 1 answers

0
MD Zand On

It depends on the position of the performance bottleneck. If you are having a very big data set from the view before filtering, using a stored procedure may help. Although the filtering usually could be also handled with Linq queries even without using sp. I can recommend you putting you time in database optimizations for better index definitions and better queries that build up your view. To start take advantage of Database Engine Tuning adviser and Sql Server Profiler.