Defining Indexes for an Event Class

You can significantly enhance the performance of a Notification Services application by creating appropriate indexes for each event class. By speeding the location of records based on the data in a specified field, indexes can improve overall application performance.

Notification Services automatically creates indexes on the system-defined EventID and EventBatchID fields.

Custom Indexes

You can add custom indexes to an event class by writing indexing statements. The following example shows the Transact-SQL syntax for creating an index on the StockSymbol field of the StockEvents event class:

CREATE INDEX StockIndex
ON appSchema.StockEvents (StockSymbol);

Notice that you create the index on the event class in the application schema. You only need to know the event class name, application schema name, and field names to create an index.

When Notification Services creates the application, it creates the event class tables and views and then adds the custom indexes.

Note

Notification Services adds custom indexes to the view representing the event class. The view contains only the current batches of events from the event class table. Running rules run against the event class view rather than the entire table improves performance and prevents duplicate notifications.

When you update the application, Notification Services drops and recreates the event class tables, views, and their associated indexes if there are any changes to the event class.

For more information about SQL Server indexes, see Indexes.

To define custom indexes for an event class

If you are defining an application through XML, define custom indexes in the application definition file (ADF). If you are defining an application programmatically, use the Notification Services Management Objects (NMO) to define custom indexes.

See Also

Concepts

Defining the Application Database
Defining Core Event Class Properties
Defining Chronicles for an Event Class

Other Resources

Building Notification Solutions
Defining Event Classes

Help and Information

Getting SQL Server 2005 Assistance