How to interpret database properties "documents" size

I have been developing on Lotus Notes for quite sometime but I have never
really administer a database.

In many application database I notice that if I create a view to select all
documents in the database using Select @All and count the number of documents
this doesn’t tally with the number of documents shown the the database
properties.

{]

{]

When soft delete is enabled this could obviously be be due to the deletion
stub. In this case for example soft delete has been disabled,

Can anyone explain where these differences come from?

Subject: How to interpret database properties “documents” size

The most common source of the difference is profile documents.

Profile documents do not list in any view, but do get included in the database properties.

Another option is a Readers field on some of the documents.

Subject: How to interpret database properties “documents” size

The most common source of the difference is profile documents.

Profile documents do not list in any view, but do get included in the database properties.

Another option is a Readers field on some of the documents.

Subject: RE: How to interpret database properties “documents” size

Michelle

Thanks for responding, I found some documents that somehow didnt show up in the view Select @All. It is strange but I need to understand how that could have happened.

Regards

Subject: RE: How to interpret database properties “documents” size

If you have responses and delete the parent doc leaving responses, parent doc is not really deleted and it counts as document in database properties.

Such documents are left-overs until its responses are deleted.

You can build a dummy db to validate this info.

The simplest way to eliminate this difference is to create a new replica of the database.

If there are - really - left-overs, there is (or there was) something wrong with the database.

Subject: RE: How to interpret database properties “documents” size

No, when you delete a document, it’s really deleted. But if a view is hierarchical, and the parent document no longer exists (or exists but isn’t selected by the view selection formula) then the responses will not display because there’s nothing for them to attach to. To really see all the documents, make the view non-hierarchical.

Subject: RE: How to interpret database properties “documents” size

Sorry, but it is not.You can reproduce this.

Get a document (M) and create two responses (R1 and R2) for it.

Create a response (C1) to the response (R1).

Create a response (C2) to the response (R2).

Delete reponse R1.

Using lotusscript:

set m = document (M)

set resp = m.Responses

Print resp.Count

It will print two documents.

If you try looping thru the collection, printing - for instance - document unique id, it will failed.

This happens because, there will be a document with size among responses.

It is correct that this document is not shown in view, but it really not deleted from database.

Subject: RE: How to interpret database properties “documents” size

If soft deletions are enabled, then of course the document is not really deleted right away.

Otherwise, there are things that can make the document appear to still be there:

A deleted document is converted to a “deletion stub”, so that when you replicate the database it will know that the document has been deleted and will delete it from another replica. The deletion stub has the same UNID as the document.

Please note the IsDeleted property of NotesDocument, which can be used to tell whether a supposed document is really a deletion stub.

Also, NotesDocument objects are help in cache by the client, and if the document is deleted without the LotusScript environment getting to know about it, it might still be in the cache.

I’m not sure offhand whether a soft-deleted document will still show up as a response. But if a document is hard-deleted, it’s gone. The data has been overwritten for security (usually) and the deletion stub with that ID is not a document.

Subject: RE: How to interpret database properties “documents” size

Andre,I had just tested here with two different databases: one with soft delete enabled, the other without it.

I had simulated the situation I had mentioned: a Main doc, with 3 responses, each one with 3 response to response.

Deleting a Response document will leave behind 3 response to response withou a parent doc.

No matter if the database has soft delete enable, the number of documents doesn’t change.

Using a LotusScript to count number of responses (Doc.Responses property) it still prints 3 as result.

I have NSFs here if you wish to see it for yourself.

Let me know how to send you these files.

Subject: RE: How to interpret database properties “documents” size

The number of documents is read when you open the database, and isn’t updated until you exit and re-enter the database – at least in the case of existing documents being changed to deletion stubs. You will need to close all windows to the database, including in Designer.

Yes, the deletion stub is still a response to the original document, but it still is a deletion stub, not a document. Try this code (note the test of IsValid):

Dim strDat$, strOne$

Dim collResp As NotesDocumentCollection

Set collResp = doc.Responses

Dim resp As NotesDocument

strDat =  {'} & doc.Subject(0) & {', responses=} & collResp.Count

Set resp = collResp.GetFirstDocument

Do Until resp Is Nothing

	If resp.IsDeleted Then

		strOne = "DELETED: noteid=" & resp.NoteID

	Elseif Not resp.IsValid Then

		strOne = "DELETION STUB: noteid=" & resp.NoteID

	Else

		strOne = {'} & resp.Subject(0) & {' noteid=} & resp.NoteID

	End If

	strDat = strDat & NL & strOne

	Set resp = collResp.GetNextDocument(resp)

Loop

Msgbox strDat

Subject: RE: How to interpret database properties “documents” size

I had a previous code similar to yours and here are the results.DB with soft deletions enabled

Starting…

IsDeleted: False

IsValid: True

IsDeleted: True

IsValid: True

IsDeleted: False

IsValid: True

The end

DB with soft deletions disabled

Starting…

IsDeleted: False

IsValid: True

Size 0 found

IsDeleted: False

IsValid: False

IsDeleted: False

IsValid: True

The end

During LS debug, when soft deletions are enabled db keeps the document and set it as valid and deleted.

When soft deletions are disabled - and that’s my whole point - the document becomes a “ghost”, a 0-size document with valid and deleted flag false.

I haven’t tested yet when soft deletions expires, but I will wait until it expires and run agent again.

Stay tuned.

Subject: RE: How to interpret database properties “documents” size

I don’t understand what you mean by “ghost” that’s different from a deletion stub. The NotesDocument object you get from Responses is a handle to the deletion stub. Your own output shows IsValid=False, which means it’s a deletion stub – read the doc. The deletion stub does not contribute to the count of documents (once you’ve exited the database so that the count is refreshed in the UI). If you’re saying something else, I’m missing it – it seems like you just feel like calling a deletion stub a “ghost” instead. Fine, call it what you like.

Subject: RE: How to interpret database properties “documents” size

My argument is that:A document is not immediately deleted from a database when soft deletions are disable, as you said before.

This can be seen in my example. There is a 0-sized document (a deletion stub, if you prefer) that is returned by the Responses property.

And, from my point of view, this is wrong and code is needed to workaround it.

Also, this document is kept as part of the number of documents in the database, which is also wrong, since it was deleted and became a deletion stub, right??

It is important to say again: this only happens when a document is deleted and it has responses.

This is not really a big deal, but in an application that has to handle response trees using lotus script or when users remove docs that has responses document count is affected.

Subject: RE: How to interpret database properties “documents” size

Please, check if this database has responses and let me know.