temp-tables

Comparison of Explain Statement Output on Amazon Redshift

风格不统一 提交于 2019-12-24 18:13:31
问题 I have written a very complicated query in Amazon Redshift which comprises of 3-4 temporary tables along with sub-queries.Since, Query is slow in execution, I tried to replace it with another query, which uses derived tables instead of temporary tables. I just want to ask, Is there any way to compare the " Explain " Output for both the queries, so that we can conclude which query is working better in performance(both space and time ). Also, how much helpful is replacing temporary tables with

Temporary table in multithread

前提是你 提交于 2019-12-24 10:29:41
问题 I have a multithread application. Each thread executes store procedures in which I create a local temporary table. The name of the temporary table is the same : #TempTable I have a conflict between thread when they manipulate this #TempTable How can I make a #TempTable for each thread with the same name ? 回答1: So long as the multiple threads are using separate connections (which I really hope they are, otherwise there's probably no benefit to multithreading, or you have a massive race

trigger and transactions on temporary tables

蹲街弑〆低调 提交于 2019-12-24 09:13:58
问题 can we create trigger and transactions on temporary tables? when user will insert data then , if it is committed then the trigger would be fired , and that data would go from the temporary table into the actual tables. and when the SQL service would stop, or the server would be shutdown, then the temporary tables would be deleted automatically. or shall i use an another actual table , in which first the data would be inserted and then if it is committed then the trigger would be fired and the

join temptable using joinsin sql

丶灬走出姿态 提交于 2019-12-24 08:08:16
问题 I have two columns vendornum and invoice status in my temp-table. Now I want to join three more columns EY_AmountIncl_LC,EY_AmountExcl_LC,EY_datedocumented to that temptable and output should look like following. VendorNumber EY_AmountIncl EY_AmountExcl EY_datedocumented InvoiceStatus 50000471 281072 281072 00:00.0 V-Parked Items 5200991 80000 80000 00:00.0 V-Parked Items 5200595 72401.6 72401.6 00:00.0 V-Parked Items 5202384 402207.68 402207.68 00:00.0 V-Parked Items Is there may way to do

Using “AS” in MySQL - not as aliases

柔情痞子 提交于 2019-12-24 01:39:22
问题 I was kinda surprised when I saw following: CREATE TEMPORARY TABLE X (ID int) AS SELECT NumColumn FROM Table I have tried to google it but only found using this as alieases. What this use actually is? I feel bit confused since I was stupidly creating temporary table and then fill it by using of insert.. Thank you 回答1: Its how you create a temporary table and populate it with the results of a select query. You can see it in the documentation at the very bottom of the CREATE TABLE specification

Using openrowset to read an Excel file into a temp table; how do I reference that table?

时间秒杀一切 提交于 2019-12-24 00:58:08
问题 I'm trying to write a stored procedure that will read an Excel file into a temp table, then massage some of the data in that table, then insert selected rows from that table into a permanent table. So, it starts like this: SET @SQL = "select * into #mytemptable FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database="+@file+";HDR=YES', 'SELECT * FROM [Sheet1$]')" EXEC (@SQL) That much seems to work. However, if I then try something like this: Select * from #mytemptable I get an error:

TempDB Log File Growth Using Global Temp Tables

独自空忆成欢 提交于 2019-12-24 00:47:41
问题 This is really a two prong question. One, I'm experiencing a phenomenon where SQL server consumes a lot of tempDB log file space when using a global temp table while using a local temp table will consume data file space? Is this normal? I can't find anywhere on the web where it talks about consuming log file space in such a way when using global temp tables vs. local temp tables. Two, if this is expected behavior, is there any way to tell it not to do this :). I have plenty of data space (6

Firebird global temporary table (GTT), touch other tables?

≡放荡痞女 提交于 2019-12-23 17:44:57
问题 I have a Firebird database (v. 2.5), I'm not allowed to create procedures, views or tables into the database, because of losing support. My view is too long: Too many Contexts of Relation/Procedure/Views. Maximum allowed is 255 I think I can solve this Problem by creating GTT, right? My question is, this GTT will be stored in the Database? When is the GTT deleted? I tried in a copy of my database and created a GTT, after that I closed my connection and reconnected and the GTT was there

How to dump temporary MySQL table into a file?

谁都会走 提交于 2019-12-23 10:25:30
问题 Is there a way to create a dump/export/save a temporary MySQL table into a file on disk(.sql file that is, similar to one that is created by mysqldump)? 回答1: Sorry, I did not read the question properly the first time around... at any rate, the best I can think of is using the SELECT ... INTO OUTFILE statement, like this: SELECT * INTO OUTFILE 'result.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM temp_table; This does have many limitations thought, for

Deleting Global Temporary Tables (##tempTable) in SQL Server

只愿长相守 提交于 2019-12-23 06:48:35
问题 Does SQL server automatically purge these out after a given length of inactivity or do I need to worry about purging them automatically? If so, how do I query for a list of tables to purge? 回答1: Local temporary tables are destroyed when you close your connection to SQL Server. There is no need to manually purge them under normal circumstances. If you maintain a persistent connection, or connection pooling, you may want to get in the habit of dropping temporary tables immediately after use.