Groups | Blog | Home
all groups > sql server replication > april 2006 >

sql server replication : Creation of Indexes on the subscriber database



georgeg
4/20/2006 5:42:02 AM
I have to create a number of indexes on the publisher database. These indexes
are then replicated to the subscriber, and the distributor agent is taking
many hours to delivered these transactions. Can I prevent these indexes from
replicating, and then recreate them on the subscriber database? The tables
with these indexes are already replicated, these are new indexes.
Thanks,
--
George Gopie
georgeg
4/20/2006 6:37:03 AM
Hilary,
The custom script that I ran on the publisher DB has the following commands
IF EXISTS (SELECT name FROM sysindexes WHERE NAME =
N'x1_SegregationCRRecommendation')
DROP INDEX SegregationCRRecommendation.x1_SegregationCRRecommendation
CREATE INDEX x1_SegregationCRRecommendation ON SegregationCRRecommendation
(Segregation)

IF EXISTS (SELECT name FROM sysindexes WHERE NAME = N'x1_SamplingPeriod')
DROP INDEX SamplingPeriod.x1_SamplingPeriod
CREATE INDEX x1_SamplingPeriod ON SamplingPeriod
(PeriodSequence,DiscontinuedFlag,ScheduledFlag)

Are u saying that after running this on the publisher DB, I can prevent it
from replicating an then run these statements on the subscriber DB? or
I have to to run
Sp_AddArticle @publication'Geo_Publ'
@Ceraetin_script 'CrIdx.sql'
George Gopie



[quoted text, click to view]
georgeg
4/20/2006 7:17:03 AM
Paul,

The problem is that the distribution agent keeps moving status from
Delivering Replicated Transactions to This process is waiting for a response
from the backend server. This seems to take many hours, and no other
transaction is replicated.
--
George Gopie



[quoted text, click to view]
Hilary Cotter
4/20/2006 9:15:32 AM
Yes, use a custom creation script for this - use the @creation_script
parameter of sp_addarticle. Then apply the indexes using a post snapshot
command script.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

Hilary Cotter
4/20/2006 10:20:38 AM
If you bcp into a table with indexes the bcp process takes far longer than
if the table did not have indexes on it. Also the odbcbcp utility does not
know about the order hint. It is faster to create them after the process has
completed.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

Hilary Cotter
4/20/2006 11:17:53 AM
Really? I'll have to confirm this. I was thinking more about the
clustered/unique indexes.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

Hilary Cotter
4/20/2006 11:27:29 AM
you are completely correct Paul! Thanks for the correction. All indexes are
created after the bcp operation is complete.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

Hilary Cotter
4/20/2006 12:00:21 PM
Also are you using the concurrent snapshot option? This causes significant
messages like the backend message you are getting.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

Paul Ibison
4/20/2006 2:57:14 PM
George,
I'm not too sure why this is seen as an advantage. If the initialization
process creates the indexes or you create them manually it'll take the same
length of time. Perhaps the issue is that you are using a shared
distribution agent? In that case I'd set up an independant one (I usually do
this anyway to avoid errors clogging up unrelated publications).
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Paul Ibison
4/20/2006 3:36:48 PM
AFAIR the non-clustered indexes are created after the data-load naturally?
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)



Paul Ibison
4/20/2006 4:55:13 PM
George - I had a publication where this stage would take hours. AFAIK
there's no shortcut. What I do is dbcc inputbuffer to see which index it is
up to which at least gives me confidence that everything is proceeding
normally.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)



georgeg
4/21/2006 10:36:01 AM
Do you know if I increase or decrease the snapshot agent the BCpBatchSize
from 100000, will improve performance. Also, are there any other properties
that can increase performance?
--
George Gopie



[quoted text, click to view]
Hilary Cotter
4/21/2006 3:42:50 PM
It will slow it down but can prevent the agent being marked suspect. If you
have a multiproc subscriber use inprocloader

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

georgeg
4/24/2006 6:23:02 AM
Hilary,
How and where you set the inprocloader? Is this a parameter on the
ditribution agent?
--
George Gopie



[quoted text, click to view]
Hilary Cotter
4/24/2006 9:38:59 AM
Yes it is! Right click on your distribution agent, select properties, select
the steps tab, double click on run step, and in the command box
type -InProcLoader.


--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

AddThis Social Bookmark Button