473,657 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

insert into indexed table

Jay
Hi I have a huge table with over 100million records and on regular
basis ineed to delete nearly a million records and insert a million
records.
Currently I delete indexes before going through the process and
recreate the indexes which takes a very very long time.
IS there a way to disable indexes and re enable them after doing
insert and delete by reindexing or anything of that sort?
OR
Is there an approach to append two tables with similar indexes?

Please air you opinior, will mean a lot to me.
Thnaks
Jul 20 '05 #1
1 6064
we**********@ya hoo.com (Jay) wrote in message news:<95******* *************** ****@posting.go ogle.com>...
Hi I have a huge table with over 100million records and on regular
basis ineed to delete nearly a million records and insert a million
records.
Currently I delete indexes before going through the process and
recreate the indexes which takes a very very long time.
IS there a way to disable indexes and re enable them after doing
insert and delete by reindexing or anything of that sort?
OR
Is there an approach to append two tables with similar indexes?

Please air you opinior, will mean a lot to me.
Thnaks

Jay,

You have a few problems to bear in mind when dealing with tables this
large and with such a turnover of data.

Firstly, as you've discovered, index rebuilds can take an age. I'd
consider partitioning this table if possible, either horizontally or
vertically. Books Online has a good discussion on partitioning and
ways to retrieve data from partitioned tables. The major benefit for
you would be that the index rebuilds will each be on smaller tables
(the member tables within the partitioned table), and may not be
required on all of these tables either.

You could also try rebuilding your indexes using the SORT_IN_TEMPDB
option - this can be particularly good if tempdb is on its own
separate device (which it should be, ideally). It allows you to
reduce disk I/O contention on the table's database, and can improve
index rebuild speed significantly.

Secondly, by deleting/re-inserting 1 million rows out of 100 million,
you may be severely skewing your table data statistics that the
optimizer relies on. I say "may be" because I don't know what rules
your deletes and inserts follow; if you're deleting and re-inserting
randomly throughout the table, then maybe it won't be so bad, since
you're only changing 1% of the data. If you're deleting 1 million
rows from one end of the table and re-inserting at the other, however,
this could make a substantial difference to the "spread" of the
statistical information.

By rebuilding your indexes, you will be partially correcting for all
this, since statistics will be updated at the same time (unless you're
using the STATISTICS_NORE COMPUTE option). However, these will only be
sampled statistics with a table of this size (i.e. they won't take all
rows into account, only a certain percentage of them). Furthermore,
the statistics are only computed (and maintained automatically
thereafter) for the leading column in any composite indexes. You can
improve on this by running the UPDATE_STATISTI CS command and
specifying the INDEX option, (or COLUMNS if you want to also include
non-indexed columns), together with the FULL keyword, which will
recreate your statistics based on all the table data, not just a
sample.

For a table this size, you may want to consider disabling autostats
updates, too, since these can kick in at inconvenient moments, and be
quite an overhead on a table of this size. You may find it better to
disable the automated updates by using the STATISTICS_NORE COMPUTE
option when rebuilding the index, and to then schedule manual UPDATE
STATISTICS commands at a predictable time so as to give you more
control. If there is no suitable out-of-hours time to rebuild the
statistics manually, then it would be best to leave the auto update
option ON.
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1796
by: Eric | last post by:
I'm trying to insert data for a real-time application that demands less than 3 second receipt-to-commit time, has a relatively large (500,000 records/hr) data rate, and requires access times on the order of 10-15 seconds. We're storing about 24 hours worth of data on a rolling basis, so I've partitioned the table by hour. Three of the columns are (separately) indexed. I know I can do this by piping data through sqlldr into the live...
4
2785
by: MAB71 | last post by:
I'm running an ISP database in SQL 6.5 which has a table 'calls'. When the new month starts I create a new table with the same fields and move the data of previous month into that table and delete it from calls. So 'calls' holds the data of only the current month. for example at the start of november 2003 I ran the queries Create Table Oct2003Calls { ................ ................
16
17004
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
5
4128
by: Paul Shaw | last post by:
Can anyone explain why an insert might cause multiple logical bufferpool data reads? Here's a situation that has me scratching my head. Table A's data resides in tablespace B Table A's indexes reside in tablespace C Table A has no long data No other data resides in either of these tablespaces.
8
6284
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with one-to-one relationship but on this occasion I must keep username/password details within a seperate table. Here's the basic specs and database schema: -------------------------------------------
8
3509
by: nano2k | last post by:
Hi Shortly, I keep invoices in a table. Occasionally, someone will fire the execution of a stored procedure (SP) that performs several UPDATEs against (potentially) all invoices OLDER than a date that is supplied to the SP as a parameter. The SP is usually a lengthy process (it takes at least 30 mins). The problem is that SQL server 2000 Dev Edition doesn't allow me to insert new invoices that are "younger", while the SP is executing....
2
1630
by: Danyork | last post by:
Hello, I'm relatively new to VBA, and was wondering if someone would help me debug the code below. I want to put it in a form, so that when I click "OK" it inserts a new record into the ActionItems table. I only want to insert the one field "Review_ID" which is a foreign key, although the table has many other fields. The primary key in the table is ActionItem_ID, and is an Autonumber. The primary key is the only field indexed with "Yes...
4
5104
bugboy
by: bugboy | last post by:
I'm inserting a new word into table 'w' and a definition into table 'c' which are linked in table 's' which is the relation table for the many to many relationship between 'w' and 'c'. I've been passed 2 variables from a form; $word and $def and i'm inserting them ok but i'm having trouble getting and passing on their ID's in order to insert them into the relation table 's' I've checked every query and they all work individually, so i...
0
2620
by: Tawfiq | last post by:
Hi, I have got the following situation please give me some ideas how to solve/work around it. Current situation: Everyday day about 10 million records are processed and bulk inserted in individual tables. Around 20K records are inserted at a time. At the end of the day this table is clustered indexed. The field used for indexing is not a primary key. There is no primary key in this table. After indexing read access is given and
0
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.