Re: Index Speed use of REPLACE in clause
From: Gert-Jan Strik (sorry_at_toomuchspamalready.nl)
Date: 12/17/04
- Next message: Bryn: "SQL Server 2000: Cant Install on Win 2003 Server Web Edition"
- Previous message: Yog: "ct_connect errors in xp_cmdshell"
- In reply to: Adam Machanic: "Re: Index Speed use of REPLACE in clause"
- Next in thread: Adam Machanic: "Re: Index Speed use of REPLACE in clause"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Dec 2004 15:58:59 +0100
Thanks,
Gert-Jan
Adam Machanic wrote:
>
> Confirmed:
>
> Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05
> Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows
> NT 5.0 (Build 2195: Service Pack 4)
>
> |--Compute
> Scalar(DEFINE:([Customers].[CompanyNameNoSpace]=replace([Customers].[Company
> Name], Convert(space(1)), Convert(''))))
> |--Bookmark Lookup(BOOKMARK:([Bmk1000]),
> OBJECT:([Northwind].[dbo].[Customers]))
> |--Index
> Seek(OBJECT:([Northwind].[dbo].[Customers].[IX_Customers_CompanyNameNoSpace]
> ), SEEK:([Customers].[CompanyNameNoSpace]=Convert([@1])) ORDERED FORWARD)
>
> :-)
>
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
> "Gert-Jan Strik" <sorry@toomuchspamalready.nl> wrote in message
> news:41C2E4BC.868B93CB@toomuchspamalready.nl...
> > I could be wrong. I thought that maybe indexes on computed columns would
> > not be automatically used in Standard Edition, just as indexes on views
> > are not automatically used (unless you use Enterprise Edition or provide
> > special hints).
> >
> > But as I said: I could be wrong. Maybe someone with Standard Edition can
> > test this example to see if an index seek is used.
> >
> > USE Northwind
> > GO
> > ALTER TABLE Customers ADD CompanyNameNoSpace AS
> > Replace(CompanyName,space(1),'')
> > GO
> > CREATE INDEX IX_Customers_CompanyNameNoSpace ON
> > Customers(CompanyNameNoSpace)
> > GO
> > SET SHOWPLAN_TEXT ON
> > GO
> > SELECT * FROM Customers WHERE CompanyNameNoSpace='EasternConnection'
> > GO
> > SET SHOWPLAN_TEXT OFF
> >
> > Gert-Jan
> >
> > Adam Machanic wrote:
> > >
> > > "Gert-Jan Strik" <sorry@toomuchspamalready.nl> wrote in message
> > > news:41C22D18.3AE1AF4E@toomuchspamalready.nl...
> > > > Yes, a little test on the Northwind database suggests that this should
> > > > work (provided you are using Enterprise Edition).
> > >
> > > What's Enterprise Edition have to do with it?
> > >
> > > --
> > > Adam Machanic
> > > SQL Server MVP
> > > http://www.sqljunkies.com/weblog/amachanic
> > > --
- Next message: Bryn: "SQL Server 2000: Cant Install on Win 2003 Server Web Edition"
- Previous message: Yog: "ct_connect errors in xp_cmdshell"
- In reply to: Adam Machanic: "Re: Index Speed use of REPLACE in clause"
- Next in thread: Adam Machanic: "Re: Index Speed use of REPLACE in clause"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|