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 8658899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:52:37+00:00 2026-06-12T15:52:37+00:00

I have a very simple query that I am trying to optimize. issues_notes is

  • 0

I have a very simple query that I am trying to optimize. issues_notes is a simple table, while meta_users is a table on a remote database server that I am querying via a view.

when I run the query without ordering it returns immediately, but when I add ORDER BY date it takes about 4 seconds to return. I had SQL Server show the execution plan, and it appears that the slowness is introduced in a Table Spool operation that happens only on the join. Is there a way to prevent this “optimization”?

Query:

SELECT 
    [issues_notes].[date], 
    [meta_users].[firstname], 
    [meta_users].[lastname], 
    [issues_notes].[note] 
FROM 
    [issues_notes] 
    LEFT JOIN [issues_issue] 
        ON ([issues_notes].[issue_id] = [issues_issue].[id]) 
    LEFT OUTER JOIN [meta_users] 
        ON ([issues_notes].[author_id] = [meta_users].[userid]) 
WHERE 
    ([issues_issue].[issue_hash] = '%s' ) 

Execution Plan without Order By:

enter image description here

Execution Plan With Order By:

enter image description here

  • 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-06-12T15:52:38+00:00Added an answer on June 12, 2026 at 3:52 pm

    The Table Spool is a “Lazy Spool”. That means it remembers rows it has seen, but does not do any extra work. Because the rows coming in on the left of the join are now sorted, repeating rows with the same value will show up right after one another. The spool allows to just reuse them instead of hitting the remote server again.

    The sort itself is a blocking operator. That means it will hold all rows before the sort and return them only after the sort is finished.

    How many rows are we talking here? What is the total execution time of both queries?

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

Sidebar

Related Questions

I have a very simple query that's giving me unexpected results. Hints on where
I have a very simple query that only returns one record. When I try
I have a very simple database consisting of these tables. Here I am trying
I have a very weird problem while trying to pass and SQL query using
Trying to perform a very simple task here. I have an <ol> that contains
On my SQL server I have a very simple table for testing, which only
I am querying an Oracle 10g database using OleDb. My query is very simple,
I have a very simple table that contains a list of 'victims' and the
Ok guys, here's the story, I have a very simple query I'm trying to
I'm trying to run a query on a very simple table but I'm not

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.