Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7411229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:21:20+00:00 2026-05-29T06:21:20+00:00

I’m using EF 4, and I’m stumped on another quirk… Basically, I have a

  • 0

I’m using EF 4, and I’m stumped on another quirk… Basically, I have a fairly simple stored procedure that’s responsible for retrieving data from SQL and returning a complex type. I have the stored procedure added to my model via a function import. It’s more or less in the following structure.

using (ModelContainer context = GetNewModelContainer())
{
   return context.GetSummary(id, startDate, endDate, type).ToList();
} 

I should mention that the code above executes over a remote SQL connection. It takes nearly 10 minutes to execute. However, using SQL Server Management Studio over the remote connection, the stored procedure executes almost instantaneously.

There are only 100 records or so that are returned, and each record has approximately 30 fields.

When I run the code above locally (no remote connection) against a backup of the customer’s database, it executes without any delay.

I’m stumped on what could be causing this performance hit. 10 minutes is unacceptable. I don’t think it’s the stored procedure. Could it be the serialization due to the remote connection? Any thoughts on how I can track and correct down the culprit?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:21:20+00:00Added an answer on May 29, 2026 at 6:21 am

    The symptoms you are describing are those usually associated with an incorrectly cached query plan (due to parameter sniffing).

    Ensure your statistics are up to date, and rebuild indexes if they are fragmented.

    The canonical reference is: Slow in the Application, Fast in SSMS? An absolutely essential read.

    Possible useful SO links:

    • Option Recompile makes query fast – good or bad?

    • Strange problem with SQL Server procedure execution plan

    • SQL Server function intermittent performance issues

    • Why is some sql query much slower when used with SqlCommand?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I am doing a simple coin flipping experiment for class that involves flipping a
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.