473,387 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

TempDB issue

8
Hello,

I have database that is using high tempdb usage in MSSQL 2008. I found the query that is causing the issue and tried to streamline the query but it still has queries going into the tempdb and uses 100% of HDD which creates lag. The database has high usuage and is around 10million rows.

I have tried to create multiple tempdb files but those just increase the tempdb writing more.

Any suggestions on how to fix the usuage on the tempdb?

Thanks in advance.
Sep 21 '12 #1
3 1840
Rabbit
12,516 Expert Mod 8TB
If the query is causing the problem, then we need to see the query.
Sep 21 '12 #2
cryan
8
Expand|Select|Wrap|Line Numbers
  1. ;WITH cte_query AS (
  2.   SELECT V.*, 
  3.        ROW_NUMBER() OVER(ORDER BY VR.rank ASC) AS [row_number]
  4.   FROM [dbo].[item_search_rank] AS VR
  5.   INNER JOIN [dbo].[item_category] as A on A.id=VR.id AND A.category_id = @category_id 
  6.   INNER JOIN [dbo].[item_channel] as B on B.id=VR.id AND B.channel_id = @channel_id
  7.   INNER JOIN [dbo].[vn] as V on V.id=VR.id AND (V.language_id=COALESCE(@language_id, V.language_id) or V.language_id is null)
  8.   WHERE VR.enabled = 1
  9. )
  10.  
  11.  
  12. SELECT V.*
  13.   VX.channel_xml AS channels
  14. FROM cte_query AS V 
  15. LEFT JOIN [item_channel_xml] AS VX ON VX.id = V.id
  16. WHERE V.[row_number] BETWEEN  @start_row AND @end_row ORDER BY V.[row_number] ASC
The query is on about 10mil rows [vn], 5k rows [channel], 500 rows [category], 10mil rows [item_search_rank].
Sep 21 '12 #3
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

There's not a whole lot that you'll be able to change to make that query run faster. Do you have the proper indexes on the tables?

One thing that could be slowing it down is the language filter. But that's really a guess, it wouldn't hurt to do a test with it on and with it off.

Instead of a row number query, you could also try a top x query joined to a top x query and see if that runs any faster for you.
Sep 21 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: New DB Admin | last post by:
Is it a good thing to do? what are the cons? Are there any risks? (this is an ISP database running 24 hrs) I have sql 6.5 on Win NT with 256 MB Ram (64 MB reserved for SQL Server). tempdb size is...
10
by: Jay Chan | last post by:
I keep getting the following error message when I run a serie of SQL commands: Server: Msg 9002, Level 17, State 6, Line 15 The log file for database 'tempdb' is full. Back up the transaction...
3
by: Deaconess | last post by:
I have shut down the SQL agent, rebooted the box and still my TEMPDB is at 4 GB plus. Is there any way to shrink it another way?
3
by: tom horner | last post by:
Something strange is happening to our SQL Server DB (2000). The tempdb transaction log file continues to grow (quite slowly) for no apparent reason. We have it in simple mode, and I have tried a...
2
by: Warren Wright | last post by:
Hi All, First, where can I get some questions of this sort answered? Preferably, are there good books or online guides that I can consult for these types of answers when necessary? 1. How do...
2
by: Tom | last post by:
I received an error that the log in tempdb was full, but the log and data segments are set to automatically grow with no limit AND there is plenty of available space on the disk. So I don't...
8
by: arijitchatterjee123 | last post by:
Hi Group, I am facing a problem regarding locking. I have created a Stored Procedure in my Database. In this Stored Procedure Temprary Tables get created and after that values are inserted in...
1
by: SQL Server | last post by:
Hi, The tempdb file on one of our servers grew very large and used all available disk space. This is SQL Server 2000 SP4. I have installed hotfix version 8.00.2187. I opened a profiler trace but...
2
by: Thomas R. Hummel | last post by:
I was able to find a few posts on this topic, but none of them quite seemed to fit the situation, so I'm hoping that someone else might be able to help me here. I have a client who is using SQL...
0
by: muhammadrashidmughal | last post by:
hello what are the situation in which tempdb space boost up, or how can we check tempdb space , is there any other way that we can shrink tempdb log file,
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.