hMailServer IssueTracker

Display defect

ID
242
Short summary Performance problem in feature
Created 2009-08-15 11:36:02
Created by datta
Status Resolved
Priority 2 - High
Quick link

Applies to

Found in 5.2.1 build 359
Resolved in 5.3.1 build 1739

Problem

Hello Martin,

First of all make clear that this is not an error.
This error is a performance problem that prevents the proper functioning of the feature "Message Indexing"

When the table "hm_messages" has much records and the feature "Message Indexing" is enabled hMailServer save the following error in log

"APPLICATION" 1484 "2009-08-14 00:04:38.086" "Severity: 2 (High), Code: HM5033, Source: DALRecordset::Open, Description: Source: ADOConnection::Execute, Code: HM10046, Description: Unknown error when executing SQL statement.
SELECT TOP 100 * FROM hm_messages WHERE messagetype = 2 AND NOT EXISTS (SELECT metadata_messageid FROM hm_message_metadata WHERE hm_messages.messagetype = 2 and hm_messages.messageid = hm_message_metadata.metadata_messageid)
Microsoft OLE DB Provider for SQL Server
Timeout expired"

One possible solution we have found to this problem is to create an index in the table "hm_message_metadata" . This is the query to create the index

CREATE NONCLUSTERED INDEX [hm_message_metadata_messageid] ON [dbo].[hm_message_metadata]
(
[metadata_messageid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

Issue steps

By martin, 2009-08-15 13:38:44

How many messages do you have in the database?
What version of SQL Server are you using?

I just executed the statement in SQL Server Management Studio and looked at the execution plan for it. In my own installation, SQL server is using the hm_message_metadata_unique index during this query.

Can you check what execution plan SQL server uses on your server? (Enter the statement in Management Studio, right click on it and select Include Actual Execution plan, run the statement and then look at the Execution plan page).


By datta, 2009-08-18 22:33:16

We have over 100,000 messages in the database.
The version of SQL Server is "Microsoft SQL Server Standard Edition (64-bit)"

Before creating this index the query takes more than 20 seconds. After creating the index by only 2 seconds delay

We send the old and the new execution plan to your e-mail address martin@hmailserver.com [execution plan issue 242]


By martin, 2009-08-18 23:03:45

Hmm, I don't get the same execution plan. I guess I need to add the other index to the next planned hMailServer version (5.4.)


You must be logged on to add a step. Log on now.