Tables used to store transient data.

learn more… | top users | synonyms

3
votes
1answer
39 views

SSMS 2012 mutiple query windows using same session

I wonder if it is possible to connect multiple files or query windows in SSMS to one session? The reason is that I want to use local temporary tables that are created in one file/query-window in other ...
0
votes
1answer
219 views

Can't Delete Orphaned MySQL Temp Table

One of my servers had a hick-up yesterday and decided to leave temporary table while (while running alter table add indexes). ls -l sql -rw-rw---- 1 mysql mysql 8570 Mar 13 12:05 #sql-ib32694.frm ...
0
votes
1answer
112 views

reuse of temp table getting more time to execute

i'm creating temp table as, SELECT T.CD, T.OBJECT_CD, T.PRICE INTO #TEMP FROM TABLE_NAME T EDIT : ADDED CLUSTERED INDEX TO TEMP TABLE CREATE CLUSTERED INDEX IX_Temp_OBJECT_CD ...
12
votes
2answers
376 views

Why is table variable forcing an index scan while temp table uses seek and bookmark lookup?

I am trying to understand why using a table variable is preventing the optimizer from using an index seek and then bookmark lookup versus an index scan. Populating the table: CREATE TABLE dbo.Test ...
3
votes
2answers
4k views

Can I copy the table structure of a #temp table to a new physical table?

I have a #tempTable that was created using SELECT * INTO #tempTable FROM OPENROWSET('Microsoft.Ace.OLEDB.12.0', 'Excel 8.0;Database=MyFileName.xls', 'SELECT * FROM [Sheet1$]') Is there an easy way ...
0
votes
2answers
93 views

How can i update my database from another database using temporary tables?

I want to update tables of my database using another big database every day with using temporary tables and without returning result. How can i update it? This my temporary table : use data_pro; ...
3
votes
0answers
84 views

Why the stored procedure is much slower than a temporary table? [closed]

I want to do the updating of my database every day and I will like to use stored procedures but the time of execution of the temporary table is faster than the stored procedure. How can I optimize my ...
1
vote
2answers
115 views

Global Temporary Table used in Stored Procedure executed concurrently across sessions

I use dynamic SQL in a stored procedure and must use a global temp table so the temp table and its data is available outside the instance when sp_executesql happens. I need the stored procedure to be ...
1
vote
1answer
794 views

Inserting query result to another table hangs on “Copying to temp table on disk” on MySQL

I started the process of inserting returned results to another table. The query groups the rows in respect of indexed IDs. This causes 149,000,000 rows to be decreased to 460,000 rows. The query ...
1
vote
1answer
107 views

Creating a global temp table in a SQL Agent job

I want to create a global temp table in a SQL Server Agent Job. Here is the code: CREATE TABLE ##TestEmployee(Id int, EmployeeName nvarchar(50)) When I execute in SSMS, all is well. I then put ...
3
votes
2answers
70 views

Is copy/rename a good way to improve temp table performance?

An application I am working with contains this sequence of queries at the end of constructing a large temp table; I believe it is an attempt to improve performance by pruning dead tuples - create ...
253
votes
4answers
104k views

What's the difference between a temp table and table variable in SQL Server?

This seems to be an area with quite a few myths and conflicting views. So what is the difference between a table variable and a local temporary table in SQL Server?
0
votes
2answers
145 views

Access Oracle GTT table data from another session?

I have using Oracle GTT tables with condition ON COMMIT DELETE ROWS. Now i know GTT tables data is only session specific. 1 session cannot see the GTT data of other session in General. But is their ...
0
votes
0answers
62 views

MYSQL : Copying to TMP table nightmare

I'm having a (AFAIK) random issue. My server is MySQL and I have a query that is sometimes 10000 times slower as you can see on this screensot : http://snag.gy/vJJ39.jpg The long time occurs during 2 ...
0
votes
0answers
62 views

Sql Server 2014 AppRole not able to create temptable in tempdb

we have created Application Roles in sql server 2014 and grant the "Execute" permission on the tables and stored procedures. when i execute sp_setAppRole and then the stroredprocedure. the simple ...
0
votes
0answers
52 views

MySQL Query Causing Massive Slowdown Over Time

I've been experiencing massive slowdown on my server after launching a new website. Using MONyog I can see that after an apache/mysql restart, the queries/second starts out nice and low for around 10 ...
1
vote
1answer
109 views

What's the best practice to avoid collisions in throwaway temp tables?

In SQL Server, I'm used to creating a #temp table for temporary storage in a complex stored procedure. Not wanting to clutter up the system, I DROP the table when done. However, if I do the same in ...
3
votes
2answers
4k views

Update statement is giving an invalid column name error, even though the column exists

I have a temporary table created at the beginning of this stored procedure. It is created successfully and can be selected from and inserted to. Here is the create statement CREATE TABLE ...
0
votes
0answers
51 views

Physical Table being used a Temp Table in a warehosue. Any advantage?

As I stated in previous posts I've inherited a warehouse based on SQL Server framework. In my continuous review of existing components and the practices adopted by the predecessors I found something ...
-1
votes
1answer
86 views

Statements in State “Copying to tmp table” disrupt performance [closed]

On a MySQL database (version 5.1.73) a Magento-Shop executes a statement (A) that uses distinct, see http://pastebin.com/A2sy45nF and therefore is "Using temporary" according to "explain". ...
0
votes
1answer
119 views

Massive joins Vs Updating temp table

I'm working on a query that essentially aggregates a slew of tables together. The first method I tried was to inner join all of the tables into one nice big query that pretty much looked like this: ...
3
votes
1answer
189 views

When is mariadb creating tmp tables?

I have found, that copying to tmp table is taking most of the time of a slow query, that I wanted to optimize. I watched the output of 'profiling' in a terminal. This happens on a pics table with 6000 ...
0
votes
2answers
158 views

MySQL excessive tmp disk tables after Upgrade to 5.6

After upgrading two MySQL-Servers which run Master-Slave replication from Percona MySQL 5.5 to Percona MySQL 5.6 an excessive amount of temporary Tables gets created on the slave. The Master seems to ...
0
votes
1answer
180 views

MySQL thread states when changing an in-memory temporary table to disk-based

In High Performance MySQL (3rd edition) they state that: You can't tell whether a table was created in memory and then converted to on-disk or just created on-disk to begin with... What I was ...
4
votes
3answers
17k views

How long will a temporary MEMORY table persist if I don't drop it (MySQL)

I'm using a recursive stored procedure in MySQL to generate a temporary table called id_list, but I must use the results of that procedure in a follow up select query, so I can't DROP the temporary ...
0
votes
1answer
50 views

Large NOT IN Statement vs Creating/Populating Temp Table

I have a large daily data feed which can contain up to around 5,000 ID's. I need to delete all pre-existing records in the DB that are not referenced in the new feed. Should I create a temporary table ...
0
votes
1answer
706 views

Create and fill temp table

I have a stored procedure that selects some data and returns it. Now I also want to add a temp table, fill it with data and return it with the stored procedure. I define it as follows: create table ...
1
vote
1answer
635 views

Table Variable and Database Scope

I am a junior DBA, and I am still confused by database scope. Now I am learning about local/global temp table and table variables. I saw an example as following: declare @T1 as table ( col1 ...
6
votes
2answers
1k views

Is this temp table behaviour documented?

Query Language (SQL) and PL/pgSQL functions treat temp tables differently: begin; create table foo(id) as values (1); select * from foo; /* id ---- 1 */ savepoint s; create function f() returns ...
0
votes
1answer
90 views

Create SP for inserting data from a table to a table

I have a table that has 1 record where one field may have 2 values separated by commas (in that cases I have to create 2 records with those values separated in 2 row and the other field values are the ...
1
vote
1answer
289 views

Table variable not Recognized in stored procedure

The following stored procedure for a postgresql database attempts to insert into a temporary table 'result' of type result_load_status ,which is a table in database, and return this temporary table. ...
1
vote
3answers
833 views

best practice for 'staging' relation in stored procedure: use temp table, or view?

When I write stored procedures that take relation A and output relation Z, I like to create 'staging' relations along the way, so I can inspect the state of the data after each step in the programming ...
1
vote
2answers
252 views

Is outputting to both a result set and a temporary table possible?

I have a stored procedure that I need to both output the result set to the user and use a piece of information in the result set to possibly output other result sets. Here is a basic schema of what I ...
1
vote
0answers
126 views

Using #temp to work around Reporting Services blocking issue

Having utterly failed to resolve why a perfectly acceptable but admitidly large stored procedure was suffering the blocking process lck_m_s when called via a report in SQL Reporting Services I have ...
1
vote
0answers
293 views

Inside stored procedure, set column names of returned query according to variable

I have a query which I'd like to reuse, instead of having many different copies of it just for the sake of changing the column name. The report (for example) uses the same query, but there are either ...
11
votes
2answers
27k views

MySQL creates temporary tables on disk. How do I stop it?

We are running a site (Moodle) that the users currently find slow. I think I have tracked down the problem to MySQL creating temporary tables on disk. I watch the variable created_tmp_disk_tables in ...
1
vote
1answer
469 views

Oracle temporary table usage with XA

I'm confused about the compatibility of Oracle XA with global temporary tables. I've read several places on the internet and in the oracle documentation that say "Distributed transactions are not ...
3
votes
2answers
5k views

Are there advantages to using temporary tables over derived tables in SQL Server?

I read the derived tables have better performance than temporary tables, but anyway many SQL Server developers prefer the second ones. Why? I must do queries with large data (millions records) and I ...
2
votes
1answer
320 views

MySQL: does Index Merge Sort-Union access algorithm use temporary table?

My question is about index_merge optimization in MySQL. I have a query with a set of range conditions connected with OR. EXPLAIN of the query shows that index_merge method is used and the Extra ...
1
vote
0answers
100 views

MySQL query hanging on copying to tmp table

I'm stuck with a query hanging on 'copying to tmp table' for about 25 seconds according to the profiling. The query is used for forecasting the number of results after filtering by job_type / ...
1
vote
1answer
135 views

How big is a tmp table?

I've got an RDF table in MySQL 5.1 with the MyISAM engine. Here's the table definition: CREATE TABLE `node` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `graph` varchar(100) CHARACTER SET latin1 ...
0
votes
2answers
530 views

Is a temporary table a good solution for importing temporary data into a database

i am facing the following scenario. I have a student database in which exam results are stored. Every now and then i get a list with the names of certain students for which i need to find out how well ...
1
vote
1answer
316 views

MySQL, temporary on disk table on primary key retrieval?

MySQL 5.5.24, Windows 7 64-bit. I've InnoDB table with primary key defined on three columns: CREATE TABLE `common_descriptions` ( `object_id` mediumint(8) unsigned NOT NULL DEFAULT '0', ...
0
votes
1answer
65 views

Optimize query to minimize tmp copying time

I have this mega query : SELECT s.eleve_id, crs.id_cours as 'cours_id', mc.code as cours_code, s.employe_id, s.id_seance, '0' as theorique, s.statut, s.type_vehicule_id, s.type_conduite_id, ...
24
votes
1answer
6k views

Why is using a table variable more than twice as fast as a #temp table in this specific case?

I was looking at the article here Temporary Tables vs. Table Variables and Their Effect on SQL Server Performance and on SQL Server 2008 was able to reproduce similar results to those shown there for ...
0
votes
0answers
2k views

SQLite UPDATE two tables from VIEW or TEMPORARY TABLE

Here is the query that doesn't compile just to show how it should look like. But since I can't do Multiple table UPDATE's. This fake query should be able to run the inner UPDATE's for both tables if ...
0
votes
2answers
542 views

table does not exist

CREATE OR REPLACE PROCEDURE ProcedureX() TYPE AVERAGE_COUNT_TBL IS TABLE OF INTEGER; AVERAGE_COUNT AVERAGE_COUNT_TBL; BEGIN INSERT INTO AVERAGE_COUNT VALUES(10); END ProcedureX; It ...
0
votes
3answers
2k views

Creating a global temp table in MySQL

I am working on a MySQL stored procedure. I need to create a temp table and I want to access this temp table whenever I execute this stored procedure. I know we can't access the temp table in ...
1
vote
2answers
1k views

Should I load the data into Temp table or keep calling it from the normal table? [closed]

I am writing a procedure and find myself using the same select statement with the same where clause a lot. Currently the table holds over 55000 rows and grows about 100 or so rows each day. The two ...
2
votes
2answers
2k views

if block fails to create temp table in a procedure

I'm attempting to do this in a procedure: DECLARE @a bit = 1; BEGIN SELECT * INTO #aTemp FROM OPENROWSET( ... ); IF @a = 0 BEGIN SELECT ... INTO #bTemp FROM #aTemp; END ...