NDO: Setting instance_id as key in more tables?

Lars Michelsen lars.lists at googlemail.com
Mon Apr 30 16:52:55 CEST 2007


Hi devels,
Im developer of visualization tool Nagvis. I worked a bit on the NDO backend
to optimize the queries to the DB. I recognized that the field instance_id
is not a part of an index/key in some (or some more) tables.

For example we query the following tables in one query:
- nagios_objects and nagios_hoststatus (To get the hoststatus)

- nagios_objects and nagios_servicestatus (To get the servicestatus)

- nagios_objects and nagios_hostgroups (To get the ID of a hostgroup)
- nagios_objects and nagios_hostgroup_members (To get the members of a
hostgroup)

- nagios_objects and nagios_servicegroups (To get the ID of a servicegroup)
- nagios_objects and nagios_servicegroup_members (To get the members of a
servicegroup)

In all cases were filtering the datasets by the instance_id. But not in all
tables the field "instance_id" is indexed or a (part of a) key. I'm not the
mysql geek but I think it would be good to make the field "instance_id" in
table nagios_objects as a key - or a part of a key.
This should make the selects much more faster.

I just had a look at the queries distributed in the ndo package, I
recognized there are always joins to nagios_hosts/nagios_services etc. I
think a JOIN to the table only for checking if this is the correct
"instance_id" is to much overhead.

Some comments/ideas?

Regards,
Lars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20070430/89385704/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list