motioneye
asked on
sql 2104 select into temporary table
Hi all,
I've started to have problems with our sql server with our routine query, the query actually run to select around 100-200k of records which its getting sluggish now as our data started to piled up to 7 millions or records, I spot the slowness where the query was not moving when it already collected the records in the temporary table via select * into ##__TEMP_DATA_TABLE.
My questions here is how do I know if this slowness could due to the memory shortage factor ? does this query really saved the records in memory instead of tempb disk ?
Our sql serevr running in sql 2014 32 GB of memory with 16 CPU
I've started to have problems with our sql server with our routine query, the query actually run to select around 100-200k of records which its getting sluggish now as our data started to piled up to 7 millions or records, I spot the slowness where the query was not moving when it already collected the records in the temporary table via select * into ##__TEMP_DATA_TABLE.
My questions here is how do I know if this slowness could due to the memory shortage factor ? does this query really saved the records in memory instead of tempb disk ?
Our sql serevr running in sql 2014 32 GB of memory with 16 CPU
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How big is the database that you're working on?
How big is the tempdb database?
Where are the tempdb files stored? Do you have enough disk space in that location?
How big is the tempdb database?
Where are the tempdb files stored? Do you have enough disk space in that location?
Can you please provide the entire query ? Do you have indexes in your temp tables?
Probably the whole logic needs re-worked.
Since you've provided only a general description, I can only give a general answer. Cluster the temp tables to match the joins, particularly if the data going into the temp table is already sorted by that column(s).
Since you've provided only a general description, I can only give a general answer. Cluster the temp tables to match the joins, particularly if the data going into the temp table is already sorted by that column(s).
ASKER
we don't have problems with this query except that when it goes to select millions of records stored in temporary tables the problems start to begin.
I look into memory and how it was use, I found that when I ran this query up to step 5, the query start begin to suspended and size of memory in MEMORYCLERK_SQLQERESERVATI