| Author |
Topic |
|
im1dermike
Posting Yak Master
222 Posts |
Posted - 2008-03-27 : 14:00:23
|
| Hi. I'm new to SQL Server programming. I'm using it at my new job for the first time and catching on quickly. I've run into a problem where I run a request via interactive query and it times out. It's really annoying because it seems to happy a lot. Is this just a memory issue with my machine (it has 2.8 GB of RAM) or there a way around it?Thanks! |
|
|
bfoster
Starting Member
30 Posts |
Posted - 2008-03-27 : 14:56:41
|
| How well is the database tuned? How complicated is your query? How many records are you expecting to get back? There isn't exactly a black and white answer to your question. Most likely I would say there is something that could be done to resolve your problem. |
 |
|
|
im1dermike
Posting Yak Master
222 Posts |
Posted - 2008-03-28 : 12:34:23
|
| I'm new to SQL Server so I don't know what you mean when you ask about "tuning".The queries don't seem that complicated to me. They're mainly based off views that are based off other views and/or tables. Many contain 1-2 joins. The queries I try just to see if it won't timeout are simple ones. I just try to find out the number of records in the view (SELECT count(*) FROM <table>). I would expect them to return 5,000-30,000 records. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-03-28 : 12:35:36
|
| Are the tables indexed? Post some sample queries that are timing out plus the table structure and indexes of the tables involved in those queries.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
im1dermike
Posting Yak Master
222 Posts |
Posted - 2008-05-28 : 16:17:56
|
Sorry for the delay in replying. I hadn't gotten something that timed out in a while, but I do now and it's pissing me off. Here is the T-SQL code:SELECT DISTINCT TOP (100) PERCENT dbo.CWDSPrtcpntDemoInfo.NBR_SSN_RCPT AS SSN, dbo.Kronos_Week_Hours.CDE_PROJ AS ProviderCode, RTRIM(dbo.Kronos_Week_Hours.CDE_ACTV) AS Activity, ISNULL(NULLIF (dbo.CWDSPrtcpntActivitiesAttendInfo.CNT_HOURS_WEEKLY_ACTV, N''), 0) AS Hours, dbo.Kronos_Week_Hours.END_DATE AS Weekend, 'K' AS System, ISNULL(dbo.DD_Collecting_Providers.InstitutionProviderID, (SELECT CAPS_ID FROM dbo.AIMS_AGENCY_temp WHERE (REPLACE(LEFT(AGENCY_ID, 6), ' ', '') = dbo.Kronos_Week_Hours.CDE_PROJ))) AS ProviderIDFROM dbo.Kronos_Week_Hours INNER JOIN dbo.CWDSPrtcpntDemoInfo ON dbo.Kronos_Week_Hours.PRTCPNT_ID = dbo.CWDSPrtcpntDemoInfo.PRTCPNT_ID LEFT OUTER JOIN dbo.DD_Collecting_Providers ON dbo.CWDSPrtcpntDemoInfo.NBR_SSN_RCPT = REPLACE(dbo.DD_Collecting_Providers.SocialSecurityNumber, '-', '') AND dbo.Kronos_Week_Hours.END_DATE <= ISNULL(NULLIF (dbo.DD_Collecting_Providers.ActivityEndDate, N''), GETDATE()) AND dbo.DD_Collecting_Providers.ActivityStartDate = (SELECT MAX(ActivityStartDate) AS Expr1 FROM dbo.DD_Collecting_Providers AS List WHERE (SocialSecurityNumber = dbo.DD_Collecting_Providers.SocialSecurityNumber) AND (dbo.Kronos_Week_Hours.END_DATE >= ActivityStartDate) AND (dbo.Kronos_Week_Hours.END_DATE <= ActivityEndDate)) LEFT OUTER JOIN dbo.CWDSPrtcpntActivitiesAttendInfo ON dbo.Kronos_Week_Hours.SERV_AUTH_DETAIL_ID = dbo.CWDSPrtcpntActivitiesAttendInfo.SERV_AUTH_DETAIL_ID AND dbo.Kronos_Week_Hours.END_DATE = CONVERT(datetime, dbo.CWDSPrtcpntActivitiesAttendInfo.DTE_ENDING_WEEK)WHERE (dbo.Kronos_Week_Hours.END_DATE NOT IN (SELECT DTE_ENDING_WEEK FROM dbo.CWDSPrtcpntActivitiesAttendInfo AS Weekends WHERE (dbo.Kronos_Week_Hours.SERV_AUTH_DETAIL_ID = SERV_AUTH_DETAIL_ID))) AND (ISNULL(NULLIF (CONVERT(float, dbo.CWDSPrtcpntActivitiesAttendInfo.CNT_HOURS_WEEKLY_ACTV), N''), 0) = 0) I know it works because I can filter it for a single record, but it always times out otherwise. Even when I try to make a table out of it using SSIS. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-28 : 16:22:59
|
| Do you work for Kronos or are you a customer of theirs?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
im1dermike
Posting Yak Master
222 Posts |
Posted - 2008-05-28 : 16:24:47
|
| Well I work for a company that works with Kronos data. Do you know how I can resolve this time out issue? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-28 : 16:28:52
|
| Are the tables indexed? What is the timeout setting set to? Can you post the table structure and indexes for all tables involved in your query?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
im1dermike
Posting Yak Master
222 Posts |
Posted - 2008-05-28 : 16:45:51
|
| I have no idea what indexing (half of them are views) is nor what the timeout setting is. Can we start there? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-28 : 16:49:24
|
| Indexing is a very complex topic. It isn't something that we can teach over the Internet in this medium. Since you have very little experience with SQL, I'd suggest contacting the Kronos vendor for help on this as they are the ones who are responsible for it. If they need help optimizing their system, they can post a question here and we'd be happy to help once they provide the table structures, and indexes.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
im1dermike
Posting Yak Master
222 Posts |
Posted - 2008-05-28 : 16:52:46
|
| The issue has nothing to do with Kronos. They're just tables/views with "Kronos" in the names. The tables/views are in my server. |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-05-28 : 23:17:31
|
| Google it and you will lots of articles regarding indexes and performance tuning of Heavy query. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-29 : 12:50:19
|
| im1dermike,If we determined that you were missing indexes on your database, would you be able to add these to improve the speed of the query?Do you have Management Studio installed so that we can walk you through how to grab the things that we need to see to help you?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
|