How to View Execution Plans for Queries Containing Temporary Tables

Hello,

I am trying to view the execution plan for a stored procedure that contains a couple of temporary tables. Every time I try to view the plan, however, there is only one item in the plan with the message:

Invalid object name ‘#temp’.

If I switch the temporary tables to table variables, it appears to show the execution plan. Unfortunately, the stored procedure needs to use temporary tables, and I need to be able to measure the code changes in the execution plan. Does anyone happen to have any insight as to why I cannot view these plans or know of a way to be able to view them when the query contains temporary tables? For reference, I am using Toad for SQL Server against a SQL 2008 R2 server.

Thanks.

1 Like

I have this question too. To look at query plans I have to switch over to SSMS and SQL Sentry Plan Explorer. I basically have to divide my work into "data study" and "query optimization" pieces. I study data with Toad and use the amazingly awesome features Toad has for that. I optimize queries with Plan Explorer using it's incredibly efficient features. I don't expect Toad query plans to compete with Plan Explorer's but it would be very helpful to look at plans while I'm studying the data. I'm using Toad against SQL Server 2016.

I didn't realize this was posted in Oct 2013 (6 years ago). I was confused by the blog layout and thought it was posted Oct 13 of this year (just a couple weeks ago)...

How disappointing there isn't a fix for this or an answer after 6 years.

1 Like

Hi Eric,
we need to see votes on our Idea Pond to decide whether something is a very useful feature for many. I'm sure you know we cannot implement everything :slight_smile:
Since there's been no movement on this question for about 6 years, it doesn't seem a highly desired feature.
Do you think you could add this suggestion to our idea pond with a description of your scenario?
Thanks!

Viewing an execution plan is already built into Toad. Do I have a configuration option set incorrectly? For example, is there a setting in the Options dialog to reuse the current editor window's connection for rendering of query plans?

Is it expected behavior for Toad to be unable to find temp tables when requesting a query plan?