Help! Database size grows by 500 meg to 1 gig a week even after compact

Hello,

I have a problem that I hope someone can help me with. I have an extremely large database with about 2.5 million records. I know, I know. I can hear you all now. Listen tho, they are extremely small, imported records with 2-3 fields on them. I didn’t create this db, but I inherited it.

Now, each night new import files are created from another system. There are several agents that run nightly that each take one of these import files, deletes all of the associated records in the notes database, then imports the new set. Fun huh?

The imports don’t take long. The box is a beast and even full text indexing the database takes under an hour.

My problem is this: the database size grows by about 500 meg a week, but the document count doesn’t change. I have a compact -B that runs weekly on the database (agents are not set to run on weekends). The log tells me it reduced the size, yet the database continues to grow. View index sizes do not change. It’s gotten to the point that monthly I have to create a new db, run all of the imports, delete the existing db and start from scratch. The reason for this is that it has reached 12 gig and gone completely corrupt with an endless consistency check.

This is more maintenance then I wish to do. Does anyone know why the database continues to grow? Does it have something to do with whitespace? The agents are deleting records nightly, so you would think this would reduce the size of the database, but I am suspecting that this nightly import process is causing the database to grow in size. If these agents do not run the db size stays the same, but obviously we need these agents.

I have included code from one of the agents. They are all exactly the same except for the type of records it is deleting and creating.

Sub Initialize

Dim s As New NotesSession

Dim db As NotesDatabase

Dim dc As NotesDocumentCollection

Dim dcResp As NotesDocumentCollection

Dim doc As NotesDocument

Dim docResp As NotesDocument

Dim item As NotesItem

Dim view As NotesView

Dim nn As NotesName

Dim k As Long

Dim i As Integer

Dim isMod As Integer

Dim ss As String

Dim dateTime As New NotesDateTime(“01/01/1950”)

Dim con As New ODBCConnection

Dim query As New ODBCQuery

Dim result As New ODBCResultSet

Dim dataSourceName$

Dim dbUserID$

Dim password$

Dim display$

Dim conStatus As Integer

Dim resultStatus As Integer

'connect to the ODBC database

dataSourceName$ = “Avl”

conStatus = con.ConnectTo (dataSourceName$)

'check for connection errors

If conStatus = False Then

Msgbox con.GetExtendedErrorMessage

Exit Sub

End If

'prevent display of dialog boxes

con.SilentMode = True

'********************************************************

'setup the key query for AVL

Set query.Connection = con

query.SQL = “SELECT * FROM EXPAVL”

'catch result set errors

On Error Goto trapError

result.cacheLimit = 275

result.FetchBatchSize = 200

'generate the results set

Set result.Query = query

resultStatus = result.Execute

Set db = s.CurrentDatabase

'clear the db of existing records first

ss = “Form = ““avl”””

Set dc = db.Search(ss, dateTime,0)

Call dc.RemoveAll(False)

Do

result.NextRow

k = k+1

'Print "Importing document " & k

Set doc = New NotesDocument (db)

'doc.Reference = result.GetValue(“ProblemNumber”)

doc.AcctCode = result.GetValue(“ACCT_CODE”)

doc.InternalNo = result.GetValue(“INTERNALNO”)

doc.Mfg = result.GetValue(“MFG”)

doc.form = “avl”

doc.PartNo = result.GetValue(“PARTNO”)

Call doc.Save (True, True)

Loop Until result.IsEndOfData

result.Close (DB_CLOSE)

'catch other errors

On Error Goto trapError

Print “Done”

Exit Sub

trapODBCError:

Msgbox result.GetExtendedErrorMessage & " (" & Erl & “)”

Exit Sub

trapError:

Msgbox Error & " (" & Erl & “)”

Exit Sub

End Sub

Subject: Help! Database size grows by 500 meg to 1 gig a week even after compact

If you are deleting 2.5 million records each night that’s 2.5 million deletion stubs per day or 17.5 million per week. Does this database have to replicate anywhere? to another server? to local replicas? If not then try reducing your purge interval. Set this by lowering the “Remove documents not modified in the last nnn days” (replication settings / space savers) to 3. This will make your purge interval 1 day (3/3) instead of 30 (90/3). You do NOT have to enable the check box, just lower the number, which is probably set to the default of 90.

Subject: RE: Help! Database size grows by 500 meg to 1 gig a week even after compact

You absolutely rule my friend. That is exactly what the problem was. I have done as you said and also have a scheduled agent to purge deletion stubs I found on the forums. Thanks a million!

Joel

Subject: RE: Help! Database size grows by 500 meg to 1 gig a week even after compact

Joel,

Another option is to consider updating instead of overwriting. It’ll make the agent take a lot longer, but if it’s in the middle of the night … presumably not very many docs actually need updating out of your 2.5 million.

regards,

raphael

Subject: RE: Help! Database size grows by 500 meg to 1 gig a week even after compact

The brute force of deleting/importing document coding of doing the import is where your problem lies leaving your database littered with deletion stubs.

The simpliest approach is first re-coding to compare the fields of your query vs documents and update/insert/delete as needed. If the performance is absymal using the current LS:DO coding try recoding it in LC LSX which is substantially faster.