You are here: Re: Increasing performance by selecting one table « MsSQL Server « IT news, forums, messages
Re: Increasing performance by selecting one table

Posted by Hugo Kornelis on 09/06/05 22:14

On 6 Sep 2005 09:53:37 -0700, Matik wrote:

(snip)
>Now the question:
>- using this substring (as in example) is agood solution, or beter to
>do a inline function which will return me the part of this dataset
>(probably there is no difference)
>- will it be much faster, if i could add some fields in to
>Source_Table, containing also varchar data, but only this part which
>I'm interested in and binde these fields in view instead off using
>substring function?

Hi Mateusz,

I agree with John Bell. Store the individual data elements. That allows
you to create indexes on the columns that are frequently used in
searches. With your table + view, all searches will always result in a
table scan, which will take a looooong time.

If you want the concatenated data as well, add it as a computed column
(that way, it won't take additional storage, but the individual strings
will be concatenated when you read the table).

Example:

CREATE TABLE Mateusz
(Col1 varchar(10) NOT NULL,
Col2 varchar(20) NOT NULL,
Combined AS Col1 + Col2,
PRIMARY KEY (Col1, Col2)
)
go
INSERT INTO Mateusz (Col1, Col2)
VALUES ('Abc', 'deF')
go
SELECT * FROM Mateusz
go
DROP TABLE Mateusz
go



By the way: why do you have both an IDENTITY and a UNIQUEIDENTIFIER
column in your table, but no PRIMARY KEY? Do you really expect
quintillion rows in your table? Why do you add the unneeded "top 100
percent" to your view's defintion?

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация