Missing index on table notifications

Description

In
src/services/org/opennms/netmgt/config/NotificationManager.java
a select is frequently made on notifications:
explain SELECT eventid FROM notifications WHERE eventuei=?
The eventuei field lacks an index, so there's always a sequential scan:
opennms=# explain SELECT eventid FROM notifications WHERE eventuei=15;
QUERY PLAN
---------------------------------------------------------------- Seq Scan on notifications (cost=0.00..413.68 rows=22 width=4)
Filter: ((eventuei)::text = '15'::text)

With index:
opennms=# explain SELECT eventid FROM notifications WHERE eventuei=15;
QUERY PLAN
-------------------------------------------------------------------------------------------------- Index Scan using notifications_eventuei_idx on notifications (cost=0.00..77.31
rows=20 width=4)
Index Cond: ((eventuei)::text = '15'::text)

So may I suggest to
create index notifications_eventuei_idx on notifications (eventuei);

Environment

Operating System: All Platform: PC

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Benjamin Reed October 3, 2008 at 2:01 PM

this was done in the 1.3.2 timeframe

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

PagerDuty

Created November 25, 2005 at 12:05 PM
Updated November 4, 2015 at 3:58 AM
Resolved October 3, 2008 at 2:01 PM