NDO: Setting instance_id as key in more tables?

Ethan Galstad nagios at nagios.org
Mon May 7 21:55:35 CEST 2007


Lars Michelsen wrote:
> 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
> 

Agreed, you could get away with simpler queries for most things.  Feel 
free to submit patches, etc. for proposed changes.  I'm pretty scattered 
  dealing with multiple things at the moment, so it might be a bit 
before I get caught up...


Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org

-------------------------------------------------------------------------
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/




More information about the Developers mailing list