dbTalk Databases Forums  

Re: Importing lots of data

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Re: Importing lots of data in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SriSamp
 
Posts: n/a

Default Re: Importing lots of data - 06-30-2003 , 08:20 AM






It is a good idea to drop and re-create the indexes to improve the
performance
--
HTH,
SriSamp
Please reply to the whole group only!

"GriffithsJ" <jonathan.griffiths (AT) ipuk (DOT) com> wrote

Quote:
Hi

I wish to delete/import a lot of data into a database and want it to run
as
quickly as possible (using DTS here).

The triggers don't need to run, so to improve performance I should
obviously
disable the triggers.

Is there anything else that I should be considering here in terms of the
database schema? What about indexes - I would have thought that it would
be
more efficient to disable the indexes, import the data and then rebuild
the
index rather than keeping the index on all thie time. Is this assumption
correct? If so, is there a way to disable all indexes and re-enable them
as
one can with triggers rather than dropping them and rebuilding them (I ask
because I don't really want to hard-code the index definitions into the
DTS
package - the database schema might change from time to time and I don't
want to have to keep updating the package...).

Thanks in advance

Griff





Reply With Quote
  #2  
Old   
GriffithsJ
 
Posts: n/a

Default Re: Importing lots of data - 06-30-2003 , 08:38 AM






Hi SriSamp

Thanks for that. However, is there a way of simply disabling the currently
existing indexes and re-enabling them afterwards? I ask this because the
indexes that may be there when I design the DTS package may not be the same
ones that exist when the DTS package is run (the database schema may
change).

Alternatively, is there a way to identify at run time the indexes that
exist, store all the information necessary to re-create these indexes, drop
these indexes, import the data and them rebuild the indexes from the stored
information?

Any code examples would be much appreciated.

Thanks

Griff



Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Importing lots of data - 06-30-2003 , 08:45 AM



Whilst SriSamp is correct in the main the benefits to be had by removing
indices was reduced with the move from SQL Server 7 to 2000. It may be
beneficial to keep them in if you need to select from the destination whilst
doing a load. Try it and see.

You can script out the indicies with a drop and recreate statement by using
SQLDMO and SQLServerAgent.

--


Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"GriffithsJ" <jonathan.griffiths (AT) ipuk (DOT) com> wrote

Quote:
Hi SriSamp

Thanks for that. However, is there a way of simply disabling the
currently
existing indexes and re-enabling them afterwards? I ask this because the
indexes that may be there when I design the DTS package may not be the
same
ones that exist when the DTS package is run (the database schema may
change).

Alternatively, is there a way to identify at run time the indexes that
exist, store all the information necessary to re-create these indexes,
drop
these indexes, import the data and them rebuild the indexes from the
stored
information?

Any code examples would be much appreciated.

Thanks

Griff





Reply With Quote
  #4  
Old   
SriSamp
 
Posts: n/a

Default Re: Importing lots of data - 06-30-2003 , 08:53 AM



If you want to get the list of indexes defined on a table, you can use a
script like the following:
DECLARE @tableName VARCHAR(50)
DECLARE @sqlString VARCHAR(8000)
BEGIN
CREATE TABLE #tableIndexes
(
index_name VARCHAR(200),
index_description VARCHAR(1000),
index_keys VARCHAR(1000)
)

SET @tableName = 'authors'
SET @sqlString = 'INSERT INTO #tableIndexes EXEC sp_helpindex ' +
@tableName
EXEC (@sqlString)

SELECT * FROM #tableIndexes
DROP TABLE #tableIndexes
END
The above script will get all the indexes into the temporary table called
#tableInexes. You can then iterate through this table and form the command
for dropping the index and execute the same. For creating an index back, you
need to play-around the same set of tables or probably "sysindexes". I do
not have any script for this, but someone in the group might post it.
--
HTH,
SriSamp
Please reply to the whole group only!

"GriffithsJ" <jonathan.griffiths (AT) ipuk (DOT) com> wrote

Quote:
Hi SriSamp

Thanks for that. However, is there a way of simply disabling the
currently
existing indexes and re-enabling them afterwards? I ask this because the
indexes that may be there when I design the DTS package may not be the
same
ones that exist when the DTS package is run (the database schema may
change).

Alternatively, is there a way to identify at run time the indexes that
exist, store all the information necessary to re-create these indexes,
drop
these indexes, import the data and them rebuild the indexes from the
stored
information?

Any code examples would be much appreciated.

Thanks

Griff





Reply With Quote
  #5  
Old   
SriSamp
 
Posts: n/a

Default Re: Importing lots of data - 06-30-2003 , 09:29 AM



This has been reported as bug. Check out:
http://support.microsoft.com/default...NoWebContent=1
--
HTH,
SriSamp
Please reply to the whole group only!

"GriffithsJ" <jonathan.griffiths (AT) ipuk (DOT) com> wrote

Quote:
Interestingly, I ran the code and found a "hypothetical" index that
doesn't
exist on the schema...

hind_264648286_2A_7A_10A
nonclustered, hypothetical, auto create located on PRIMARY
fieldA, field B, fieldC

So what's this when it's at home?





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.