Re: problem with almost 2-3 GB records in a table
From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 12/01/04
- Next message: Uri Dimant: "Re: Calculating time differences"
- Previous message: Peter Newman: "Ongoing Maintenance problems"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 1 Dec 2004 11:58:52 +0100
A covering index includes all the columns referred to in the query. As the query does SELECT *, then
the index will have all the columns in the table. Because of the construction of the WHERE clause,
the index is not searchable. Scanning an index with all the table's columns in it is the same amount
of work as scanning the data pages (same amount of pages).
However, a non-covering index can be useful defined on the sales_date column. SQL server will scan
all the index pages and only "dive" into the datapages for which the expression hold true. The idea,
of course, is that there are fewer pages to scan of you only have the sales_date column compared to
all columns in the index.
-- Tibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ "JXStern" <JXSternChangeX2R@gte.net> wrote in message news:g1leq0p87gokdonjlb2urnv662ts0k0r90@4ax.com... > On Fri, 26 Nov 2004 11:07:00 +0100, "Tibor Karaszi" > <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote: > >A covering index can be very beneficial here. > >But not with SELECT *, of course. > > Hmm? > > Why not? > > Maybe there's only one record that will be selected to have all of its > fields retrieved. Is there really some magical reason the covering > index won't help in such a case? > > J. > > >
- Next message: Uri Dimant: "Re: Calculating time differences"
- Previous message: Peter Newman: "Ongoing Maintenance problems"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|