Re: problem with almost 2-3 GB records in a table

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 12/01/04


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.
>
>
>


Relevant Pages

  • Re: Is this really the best execution plan SQL2K can find?
    ... To answer some of your questions: the index I1 is a covering index, ... This basically means that for your query, ... To test with a cold cache, run at least "dbcc dropcleanbuffers" between ... >> Wayne Snyder, MCDBA, SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Index Seek (or) Index Scan in Execution Plan
    ... >> returned is usually more cost effective for SQL Server. ... >> dealing with a covering index, SQL Server has to perform a bookmark ... query in an index. ... by a bookmark lookup operation (you need to include the second unindexed ...
    (microsoft.public.sqlserver.server)
  • Re: Index Seek (or) Index Scan in Execution Plan
    ... >> returned is usually more cost effective for SQL Server. ... >> dealing with a covering index, SQL Server has to perform a bookmark ... query in an index. ... by a bookmark lookup operation (you need to include the second unindexed ...
    (microsoft.public.sqlserver.programming)
  • Re: Full-text Query very slow.
    ... Do you have a covering index? ... The query is a relatively simple CONTAINSTABLE which joins to the base table. ... INNER JOIN CONTAINSTABLE ([Work.WorkName], WorkName, ... The SQL Server version is 9.0.1399. ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Rewrite Query for tuning.
    ... However I created a non clustered covering index on the ... The Query returns rows. ... >> INNER JOIN tblProductLine ...
    (microsoft.public.sqlserver.programming)