Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Performance - my SP needs some
Message
From
30/09/2002 13:19:56
 
 
To
29/09/2002 15:08:23
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00705044
Message ID:
00706004
Views:
20
I'm beginning to believe that there's not much that you're going to be able to do. Is this the show plan for both queries? Also, I really expected the showplan to look like this:
StmtText                                                                
------------------------------------------------------------------------
  |--Bookmark Lookup(BOOKMARK:([Bmk1000]), OBJECT:([pubs].[dbo].[roysched]))
       |--Index Seek(OBJECT:([pubs].[dbo].[roysched].[titleidind]), SEEK: ([roysched].[title_id]='PS1372') ORDERED)
Did you reformat it and remove the objects?

-Mike

>>Could you post the execution plan? The order of the items is important.
>>
>>-Mike
>>
>
>Hi Mike,
>
>Here is execution plan and the associated costs:
>
>
> - INSERT: (Insert Into #temp)  --  Cost 0%
> - TABLE INSERT/Insert: (SET:Insert rows)  --  Cost 0%
> - TOP: (selecting first few rows based on sort)  --  Cost 0%
> - COMPUTE SCALAR: (getidentity)  --  Cost 1%
> - SORT: (order by)  --  Cost 0%
> - COMPUTE SCALAR: (convert)  --  Cost 0%
> - FILTER: (where)  --  Cost 0%
> - BOOKMARK LOOKUP: (bookmark lookup)  --  Cost 62%
> - NESTED LOOP: (inner join)  --  Cost 0%
> - REMOTE SCAN: (contains clause)  --  Cost 34%
> - INDEX SEEK: (object:ordered)  --  Cost 3%
>
>
>
>And here is the SP:
>
>BEGIN
> SET NOCOUNT ON
> DECLARE @intPage int
> SET @intPage = 1
> DECLARE @strSearch varchar(50)
> SET @strSearch = '"free email" AND IS_ADULT_0 AND IS_ENABLED_1'
> DECLARE @strCommonImages varchar(100)
> SET @strCommonImages  = '\images'
> DECLARE @intStart integer
> SET @intStart = (@intPage * 10) - 10
> CREATE TABLE #temp ( recID int IDENTITY (1,1), link_id int, link_title varchar (100), link_url varchar (400), link_description varchar (300), priority int, rank int )
> INSERT INTO #temp (link_id, link_title, link_url, link_description, priority, rank)
>  SELECT a.link_id, a.link_title, a.link_url, a.link_description, a.link_priority, b.rank
>  FROM odp_live.dbo._links_live a INNER JOIN
>  CONTAINSTABLE (odp_live.dbo._links_live, *, @strSearch, 100 ) b
>  ON a.link_id = b.[KEY]
>  WHERE a.link_enabled=1
>  ORDER BY b.rank DESC, a.link_priority DESC
>  OPTION (KEEPFIXED PLAN)
>
> DECLARE @intTotalRecords int
> SET @intTotalRecords = (SELECT COUNT(*) FROM #temp)
> SELECT TOP 10 @intTotalRecords as link_total, link_id, 'link_title' =
>      CASE
>         WHEN LEN(link_title) > 67 THEN LEFT(RTRIM(link_title),67) + '...'
>         ELSE link_title
>      END,
>      'link_description' =
>      CASE
>         --WHEN LEN(link_description) > 180 THEN LEFT(LEFT(RTRIM(link_description), CHARINDEX('IS_ADULT',RTRIM(link_description))-1),177) + '...'
>         --ELSE LEFT(RTRIM(link_description), CHARINDEX('IS_ADULT',RTRIM(link_description))-1)
>         WHEN LEN(link_description) > 180 THEN LEFT(LEFT(link_description, CHARINDEX('IS_ADULT',link_description)-1),177) + '...'
>         ELSE LEFT(link_description, CHARINDEX('IS_ADULT',link_description)-1)
>      END
> FROM #temp WHERE recID > @intStart OPTION (KEEPFIXED PLAN)
> DROP TABLE #temp
>END
>
>
>Thanks again for your help on this and many other matters you have helped on....
>
>Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform