Re: eliminating redundant data

From: Alan <alan_at_erols.com>
Date: Thu, 3 Jun 2004 13:36:44 -0400
Message-ID: <2i95tcFk4sghU1_at_uni-berlin.de>


Well, I don't know SQL Server, but in Oracle, you create an index using the CREATE INDEX statement. I suspect it works the same or similar in SQL Server.

Here's an Oracle example that creates an index called "asearch_client_id_idx" on the client_id field in a table called "alphasearch" owned by user "alphasearch":

CREATE INDEX ALPHASEARCH.ASEARCH_CLIENT_ID_IDX     ON ALPHASEARCH.ALPHASEARCH(CLIENT_ID); Now, I am about to lie a little bit for simplicity's sake, but here goes...

When a query is executed that uses client_id as a search or sort criteria, the Oracle optimizer will decide whether or not to use the index. If it does, it looks up the values needed in the index, and retrieves their row ids, which in turn are essentially pointers to the location of the data in data blocks on disc, so it goes dirctly to that location on disc and retrieves the data out of the blocks. It does not need to go logically into the table. Note that what I refer to as row_id in Oracle may not be the same concept in SQL Server.

Hope you get the general idea, and you should consult your documentation about indexes.

"gordy" <gordy_at_dynamicsdirect.com> wrote in message news:40bf5ec1$1_1_at_Usenet.com...
> > No database vendor, version, platform... Why are you using tables as
indexes
> > when you can use indexes as indexes? Normalizing a data model generally
> > slows it down. Denormalizing generally speeds things up.
>
> sorry, I'm using MS SQL2000
>
> How can I use indexes as indexes? I mean, in the example I posted, can
> you give an example?
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
> http://www.usenet.com
Received on Thu Jun 03 2004 - 19:36:44 CEST

Original text of this message