Subject | Re: What's the best way to do this? |
---|---|
Author | Adam |
Post date | 2005-02-22T22:27:07Z |
Based on Ann's suggestion.
The rest of the suggestions work well if it is just one table you are
clearing out, but it is a very slow operation particularily if you
have delete triggers that decide to fire.
Are you clearing the entire database? If so:
Create a createdb.sql script to create the database and metadata.
Most of the database tools around allow you to do this.
BUT
Move any index definitions to an indices.sql script, as any active
index will hurt insert speeds. If the data entering the system is
guaranteed to be "clean", you can even move the triggers and foreign
key constraints to this script.
Then every night,
drop the database
run the createdb.sql script
import the data
run the indices.sql script
If there is data in this database you do actually need, just do Ann's
suggestion. Remember if you do this suggestion, you will need to be
very sure the incoming data does obey any consistency rules if you
switch off triggers etc.
Adam
--- In firebird-support@yahoogroups.com, "Myles Wakeham" <myles@t...>
wrote:
The rest of the suggestions work well if it is just one table you are
clearing out, but it is a very slow operation particularily if you
have delete triggers that decide to fire.
Are you clearing the entire database? If so:
Create a createdb.sql script to create the database and metadata.
Most of the database tools around allow you to do this.
BUT
Move any index definitions to an indices.sql script, as any active
index will hurt insert speeds. If the data entering the system is
guaranteed to be "clean", you can even move the triggers and foreign
key constraints to this script.
Then every night,
drop the database
run the createdb.sql script
import the data
run the indices.sql script
If there is data in this database you do actually need, just do Ann's
suggestion. Remember if you do this suggestion, you will need to be
very sure the incoming data does obey any consistency rules if you
switch off triggers etc.
Adam
--- In firebird-support@yahoogroups.com, "Myles Wakeham" <myles@t...>
wrote:
> I have to copy a series of about 40 tables from an ODBC data sourceinto a
> Firebird SQL database everynight at 12 midnight. This is a 'DataWarehouse'
> dump of information from a transactional system to Firebird. Alldata in
> Firebird that was there before, can be completely deleted but I'dlike to
> keep the table structure intact.table
>
> I thought this would be a simple DELETE * from TABLE NAME for each
> that has to be transferred over, but there are primary/foreign keythe tables
> relationships between the tables and therefore I can't delete out
> without upsetting the data integrity in the database.
>
> What is the best practice in these situations?
>
> Myles
>
> ===========================
> Myles Wakeham
> Director of Engineering
> Tech Solutions Inc.
> Scottsdale, Arizona USA
> Phone (480) 451-7440
> Web: www.techsol.org