Re: Using temporary tables for query results

From: Doug Miller <drmiller100_at_hotmail.com>
Date: 13 Dec 2002 12:21:11 -0800
Message-ID: <178db91.0212131221.407358f2_at_posting.google.com>


sry_at_hotmail.com (situ) wrote in message news:<31c0a2d1.0212130255.5fc2f1ac_at_posting.google.com>...

> Effectively, we are having to execute COMPLEX_QUERY_1 multiple times.

Create a unique table name based upon the users login and datetime or something, write the results of complexquery1 to the "permanent" table, then use it to join and get the rest of the queries. Drop the "permanent" table when done.

> Question:
> Is there a more efficient approach than using Temporary tables?

Maybe. depends on what the query really is.

> Is this feature standardized across all databases? I read that
> SQLServer deletes temp tables at the end of the transaction, while
> Oracle does not. What are the performance-related implications of
> using Temporary tables?

basically, there are no performance differences between using temp tables and "permanent" tables that get dropped. There might be a teeny bit of overhead involved, but in the order of less then one second difference in response time for a big query.

-doug miller Received on Fri Dec 13 2002 - 21:21:11 CET

Original text of this message