Showing posts with label index. Show all posts
Showing posts with label index. Show all posts

Monday, March 19, 2012

How to change clustered PK to non clustered on a replicated table

Hello,
I want to know if the re is an easy way to modify the Primary Key on a
replicated table to be a non-clustered index instead. Looking through
queries hitting this table show a clustered index on a different field will
significantly increase performance.
Anyone run into this and find a solution?
Thanks.
~lbLonnye Blake Bower wrote:
> Hello,
> I want to know if the re is an easy way to modify the Primary Key on a
> replicated table to be a non-clustered index instead. Looking through
> queries hitting this table show a clustered index on a different
> field will significantly increase performance.
> Anyone run into this and find a solution?
> Thanks.
> ~lb
Unfortunately, I don't think there is an easy way to do this. If you
ever wonder how a tool , like SQL Enterprise Manager, does something
using its UI, you can run Profiler to watch the activity. When you
change a PK constraint from clustered to non-clustered it looks like SQL
EM is creating new tables with the desired changes (and this affects FK
tables as well).
What you can do is work from a test database until you get the script
working properly. The script will have to remove the FK constraints,
remove the PK constraint, change the PK constraint, and re-create the FK
constraints. Once you have the script working, you should start the
database is single-user mode and make your changes off-hours.
David Gugick
Imceda Software
www.imceda.com

Wednesday, March 7, 2012

How to calculate the index size ?

Hi:
I need to calculate the total size of all indexes, is the index_size
reported by sp_spaceused 'tablename' is what i need ?
Please help
Thanks
JCVoonThe following is a link to useful sps in what you are looking to do.
Specifically look at:
sp_columns_rowset
sp_MShelpindex
sp_MStablespace
sp_MSindexspace
In SQL Books there is an article called: Estimating the Size of a Table ,
which will give you some ideas
--
--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm
___________________________________
"jcvoon" <jcvoon@.maximas.com.my> wrote in message
news:1147078009.708121.91560@.i40g2000cwc.googlegroups.com...
> Hi:
> I need to calculate the total size of all indexes, is the index_size
> reported by sp_spaceused 'tablename' is what i need ?
> Please help
> Thanks
> JCVoon
>|||Jack Vamvas :
Thanks.
sp_MSindexspace is what i need, in fact the index_size reported by
sp_spaceused 'tablename' is sum of the Size reported by
sp_MSindexspace 'tablename' .
Regards
JCVoon

How to calculate the index size ?

Hi:
I need to calculate the total size of all indexes, is the index_size
reported by sp_spaceused 'tablename' is what i need ?
Please help
Thanks
JCVoonThe following is a link to useful sps in what you are looking to do.
Specifically look at:
sp_columns_rowset
sp_MShelpindex
sp_MStablespace
sp_MSindexspace
In SQL Books there is an article called: Estimating the Size of a Table ,
which will give you some ideas
--
--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm
___________________________________
"jcvoon" <jcvoon@.maximas.com.my> wrote in message
news:1147078009.708121.91560@.i40g2000cwc.googlegroups.com...
> Hi:
> I need to calculate the total size of all indexes, is the index_size
> reported by sp_spaceused 'tablename' is what i need ?
> Please help
> Thanks
> JCVoon
>|||Jack Vamvas :
Thanks.
sp_MSindexspace is what i need, in fact the index_size reported by
sp_spaceused 'tablename' is sum of the Size reported by
sp_MSindexspace 'tablename' .
Regards
JCVoon

How to calculate table and index size

Can anyone point me in the right direction on how to calculate table and
index sizes
TIA
RobEXEC sp_spaceused 'tablename'
http://www.aspfaq.com/
(Reverse address to reply.)
"Rob Diamant" <rob@.usi.com> wrote in message
news:#4qxCfGsEHA.808@.TK2MSFTNGP12.phx.gbl...
> Can anyone point me in the right direction on how to calculate table and
> index sizes
> TIA
> Rob
>

How to calculate table and index size

Can anyone point me in the right direction on how to calculate table and
index sizes
TIA
RobEXEC sp_spaceused 'tablename'
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Rob Diamant" <rob@.usi.com> wrote in message
news:#4qxCfGsEHA.808@.TK2MSFTNGP12.phx.gbl...
> Can anyone point me in the right direction on how to calculate table and
> index sizes
> TIA
> Rob
>

How to calculate table and index size

Can anyone point me in the right direction on how to calculate table and
index sizes
TIA
Rob
EXEC sp_spaceused 'tablename'
http://www.aspfaq.com/
(Reverse address to reply.)
"Rob Diamant" <rob@.usi.com> wrote in message
news:#4qxCfGsEHA.808@.TK2MSFTNGP12.phx.gbl...
> Can anyone point me in the right direction on how to calculate table and
> index sizes
> TIA
> Rob
>