Groups | Blog | Home
all groups > sql server clients > april 2005 >

sql server clients : Partioning the table and View


Joh
4/25/2005 4:35:46 PM
There was a MedicalHistory table in which contain 10 Billions of records so
I did partioning into five tables and
insert the data according to year. Now the problem is that when I run the
stored procedure from the table(Medical History) it took
5 seconds and when I run the stored procedure through the view which I have
created as follow it tooks 47 seconds.

Can any one let me know after creating the following view what I have to do
for speed up the retrival.


Create View MedicalHistory
as
select * from MedicalHisotory_2001
Union All
select * from MedicalHisotory_2002
Union All
select * from MedicalHisotory_2003
Union All
select * from MedicalHisotory_2004
Union All
select * from MedicalHisotory_2005

MedicalHisotory is also joining to another tables so that might cause slow
down so can I create some indexing
on the view ? please guide me.

thanks

David Gugick
4/25/2005 4:51:12 PM
[quoted text, click to view]

Do you you have the necessary indexes to perform the join operation? If
not, you'll need to add it/them. Also, try and stay away from SELECT *
syntax. Spell out the columns in the view. Personally, I would leave off
the join and create another view on this view with the join in case you
don't need access to the columns in the other table.

If you need mroe help, post your DDL for the tables.


--
David Gugick
Imceda Software
www.imceda.com
Joh
4/25/2005 4:53:29 PM
I want to add one more thing in my previous email like should I create index
on all the MedicalHisotory partioned table or index on view?

anxiously waiting for you reply


[quoted text, click to view]

Joh
4/25/2005 5:01:51 PM
I can't create the another view for joining because one procedure is already
created and in that SP they are joining to MedicalHistory table.. now I want
to ask like I have to create index on the partition table or on the view?


[quoted text, click to view]

AddThis Social Bookmark Button