October 18, 2005 at 7:43 am
My query is as below
SELECT JS.Code, FC.Name, JS.CompanyCode FROM JOBS JS LEFT OUTER JOIN CUSTOMERS FC ON JS.CCode = FC.CCode and JS.GNumb = JS.GNumb
ORDER BY FS.sdate, FS.Code, FC.Name
Table JOBS contains 3,34,516 rows , Table Customers contains 60,416 rows
It takes me 6 seconds to retrieve data (3,34,516 rows) with out order by and 15 seconds with Order by clause
I have done indexing on sdate, code, groupnumb field. Please help out if we can do something more to get the result set faster
October 18, 2005 at 9:07 am
Hi Krishna,
Please check once the order by columns with their alias names.
FS.sdate, FS.Code
Lucky
October 18, 2005 at 9:12 am
My query is as below
SELECT JS.Code, FC.Name, JS.CompanyCode FROM JOBS JS LEFT OUTER JOIN CUSTOMERS FC ON JS.Code = FC.CCode and JS.GNumb = FC.GNumb
ORDER BY JS.sdate desc , JS.Code, FC.Name
Table JOBS contains 3,34,516 rows , Table Customers contains 60,416 rows
It takes me 6 seconds to retrieve data (3,34,516 rows) with out order by and 15 seconds with Order by clause
I have done indexing on sdate, code, groupnumb field. Please help out if we can do something more to get the result set faster
October 18, 2005 at 9:27 am
335K rows in 15 seconds isn't really slow. What are the server specs. What is the execution plan?
October 18, 2005 at 11:03 am
The query does not have any filter criteria specified at all i.e. no where clause. Is there indeed a requirement to return all the 335k records back ? What does the application do after getting such a large record-set back ? An answer to that might help in determining the next course of action.
In the abscene of the execution plan and the type of indexes, I can only guess that this must be doing an index scan operation and a clustered index scan on a not null column is similar to scanning the entire table itself.
October 18, 2005 at 11:56 am
3.3 Million rows in 15 seconds isn't slow, it's screaming!
If you're getting that much data to your desktop that quickly I'd be pleased as punch.
Joe
October 19, 2005 at 4:20 am
I'd be happy with 3.3 million rows in 15 Seconds also. But Krishna is only getting 10 % of that 334,516 (it's amazing what a misplaced comma can do to the eyes) so the query isn't all that quick... But without the execution plan and server specs it's impossible to say how to speed it up.
Ged
October 19, 2005 at 5:20 am
My Executions Plan
|--Sort(ORDER BY[JS].[Sdate] DESC, [JS].[Code] ASC))
|--Hash Match(Right Outer Join, HASH[FC].[CCode], [FC].[GNumb])=([JS].[CCode], [JS].[GNumb]), RESIDUAL[JS].[CCode]=[FC].[CCode] AND [JS].[GNumb]=[FC].[GNumb]))
|--Clustered Index Scan(OBJECT[NEXT_ALL].[dbo].[CUSTOMERS].[PK_CUSTOMERS_CCode] AS [FC]))
|--Clustered Index Scan(OBJECT[NEXT_ALL].[dbo].[JOBS].[PK_JOBS_Code] AS [JS]))
Server Specifications
P VI with 512 RAM
Sharma, i have done Clustered Index for code and CCode and other are non- clustered indexes
October 19, 2005 at 6:50 am
Still doesn't answer the question of why you need ot have all those records sent to somewhere. Also that doesn't see awfully slow to me. I tried running a left join on one of my main tables and it runs in 8 secs for 250k rows (bit faster server than yours). The network can greatly affect that number by the way.
October 19, 2005 at 7:50 am
RGR'us
We need to display all these rows in a LOOK UP screen where the user can select the code , we are using date ranges to display the result set but in some cases user can give date range where all the rows fall under this...
My Server Spec
Pentium 4 not P VI
October 19, 2005 at 7:54 am
Ya we figured the part about the P 6 .
Where is the between datestart and dateend condition then??
It should be included in the query all the time.
October 19, 2005 at 8:06 am
RGR'us
Check the below query this returns me 3,34,516 rows
SELECT JS.Code, FC.Name, JS.CompanyCode FROM JOBS JS LEFT OUTER JOIN CUSTOMERS FC ON JS.Code = FC.CCode and JS.GNumb = FC.GNumb
WHERE JS.sdate >='1/1/1970' and JS.sdate <= '12/31/2005'
ORDER BY JS.sdate desc , JS.Code, FC.Name
October 19, 2005 at 8:09 am
Could you please clear this out? Is it 335K or 3.3 M rows?
October 19, 2005 at 8:16 am
335K
October 19, 2005 at 8:20 am
How fast is it to fetch only lets say one month of data?
Can you move the order by on the client?
Viewing 15 posts - 1 through 15 (of 20 total)
You must be logged in to reply to this topic. Login to reply