Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Wednesday, March 28, 2012

Reg: Datawarehouse records delete problem

Hi

Iam using SQl server 2005 Integration Service to transfer the data from Source Data Base to Datawarehouse DB. Here my main problem is after trnsfering the data from main Data Base to datawarehouse DB. If any records is delete from main database, how can we delete same records in Datawarehouse DB. If I want to delete any record in the datawarehouse that record mapped with some other tables [Foriegn Keys].

Regards,

Hanu

You should review the Project REAL ETL best practices (http://download.microsoft.com/download/4/1/f/41f09116-19b3-40fe-9d54-d1e9b7af9e82/ProjectREAL_ETLDP.doc) - the section on Slowly Changing Dimensions maybe helpful.sql

Reg: Datawarehouse records delete problem

Hi

Iam using SQl server 2005 Integration Service to transfer the data from Source Data Base to Datawarehouse DB. Here my main problem is after trnsfering the data from main Data Base to datawarehouse DB. If any records is delete from main database, how can we delete same records in Datawarehouse DB. If I want to delete any record in the datawarehouse that record mapped with some other tables [Foriegn Keys].

Regards,

Hanu

You should review the Project REAL ETL best practices (http://download.microsoft.com/download/4/1/f/41f09116-19b3-40fe-9d54-d1e9b7af9e82/ProjectREAL_ETLDP.doc) - the section on Slowly Changing Dimensions maybe helpful.

Wednesday, March 21, 2012

Referential constraints - Delete slow

Does anyone have experience with cascade delete being slow on large
databases?
It appears that the cascade delete is not making use of the existing
clustered indexes.
If I create statements deleting the same records from the 20 referenced
child tables (with children of their own) using the foreign key column of
the parent table the delete occurs in a few seconds vs over a minute for the
constraint to delete the record and all chldren. Even if the parent has no
children it takes ovr a minute for it to scan the children for potential
orphans. Since I know no way to observe the steps that the constraint is
performing I can only assume that for some reason it is not using the
existing indexes on the table.Gene
Did you have on referensing table an index?
Have you tried to run show plan of the query to see what is going on?
Personally I don't have any problem with perfomance in my VLRD when I
perfom deletion.
"Gene Black" <geblack@.cox.net> wrote in message
news:#LbuG5SCEHA.1548@.TK2MSFTNGP12.phx.gbl...
> Does anyone have experience with cascade delete being slow on large
> databases?
> It appears that the cascade delete is not making use of the existing
> clustered indexes.
> If I create statements deleting the same records from the 20 referenced
> child tables (with children of their own) using the foreign key column of
> the parent table the delete occurs in a few seconds vs over a minute for
the
> constraint to delete the record and all chldren. Even if the parent has no
> children it takes ovr a minute for it to scan the children for potential
> orphans. Since I know no way to observe the steps that the constraint is
> performing I can only assume that for some reason it is not using the
> existing indexes on the table.
>|||When I use show query plan it appears that many of the clustered indexes are
not being used. I see sorts and hash joins happening vs when I construct the
deletions using joins the clustered indexes are used.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eTKja2aCEHA.3152@.TK2MSFTNGP10.phx.gbl...
> Gene
> Did you have on referensing table an index?
> Have you tried to run show plan of the query to see what is going on?
> Personally I don't have any problem with perfomance in my VLRD when I
> perfom deletion.
>
> "Gene Black" <geblack@.cox.net> wrote in message
> news:#LbuG5SCEHA.1548@.TK2MSFTNGP12.phx.gbl...
of
> the
no
>|||After testing it appears that if I overlay a non-clustered index on top of
the existing clustered index the delete operation using the RI constraint
with cascade delete performs the same as the manually constructed delete.
The query plan using showplan looks almost identical but the performance
difference is extensive. This does not seem like a necessary solution as the
columns are already identified and used in the clustered index on the table.
I am still perplexed by the fact that it does not perform as expected until
a nonclustered index is laid over top of the clustered index.
I will have to examine it some more, maybe one of the 60 referenced tables
is missing a clustered index, since those have been applied over time
manually while the overlays were created by automated script following the
relationship tree.
"Gene Black" <geblack@.cox.net> wrote in message
news:%23LbuG5SCEHA.1548@.TK2MSFTNGP12.phx.gbl...
> Does anyone have experience with cascade delete being slow on large
> databases?
> It appears that the cascade delete is not making use of the existing
> clustered indexes.
> If I create statements deleting the same records from the 20 referenced
> child tables (with children of their own) using the foreign key column of
> the parent table the delete occurs in a few seconds vs over a minute for
the
> constraint to delete the record and all chldren. Even if the parent has no
> children it takes ovr a minute for it to scan the children for potential
> orphans. Since I know no way to observe the steps that the constraint is
> performing I can only assume that for some reason it is not using the
> existing indexes on the table.
>

Saturday, February 25, 2012

Reducing filesize while deleting rows?

I've got a very filesize restricted database. I noticed that when I insert 1000 rows my filesize jumps to 80k, but when I delete all but 50 of those rows...the filesize actually increases to 84k. How do I make sure the filesize of my database shrinks when I delete rows?

Thanks!

Use SqlCeEngine.Compact() or SqlCeEngine.Shrink() to do that. You can find description on MSDN.

|||Unfortunately I'm using native C++ for all this, so I don't have access to SqlCeEngine. Is there a SQL command i could execute to perform the equivalent to a shrink routine? If that doesn't exist I'll need some way to do it while an existing OLEDB connection is open and operating. I need this database to run 24/7 with no downtime whatsoever.

Thanks for the help!
|||

The database connection must be closed to do shrink or repair. This is a design requirement so that database file structure can be recreated.

What you can probably do is to make a copy of the database , compact it, momentarily drop connection to original database and replace original with compacted database. You will have to take a read only lock on original db while the copy is compacted so that no new changes take place.

|||

The OLEDB provider has an Engine object, which has a CompactDatabase method.

Monday, February 20, 2012

reduce num of transaction files

I have two transaction log files and I want to reduce it to one. How do I de
lete one and make sure I'm not losing any information? Can I just back up th
e transaction logs, then delete the 2nd file and it will continue logging tr
ansactions to the remaining
file?
Thanks!Hi,
It is not possible to migrate the transaction log data from one log file to
another to delete a transaction log file.
To purge the transactions from a transaction log file, the transaction log
must be truncated (Backup log <dbname> with truncate_only) or
backed up (Backup log <dbname> to disk='c:\backup\dbanme.trn).
Once the transaction log file no longer contains any active or inactive
transactions, the Empty log file can be removed from the database.
Steps to remove the Empty Log file:
backup log <dbname> to disk='c:\backup\dbname.trn'
go
use <dbname>
go
dbcc shrinkfile('logical_log_filename_to_dele
te','emptyfile')
go
alter database <dbname> remove file 'logical_log_file_name_to_delete'
Thanks
Hari
MCDBA
"holly" <anonymous@.discussions.microsoft.com> wrote in message
news:1ABE2C6B-C01F-4D16-A689-E61E1A2E68C6@.microsoft.com...
> I have two transaction log files and I want to reduce it to one. How do I
delete one and make sure I'm not losing any information? Can I just back up
the transaction logs, then delete the 2nd file and it will continue logging
transactions to the remaining file?
> Thanks!