[dev.icinga.com #2618] re-add missing indexes from #1110 resolving performance issues on all supported rdbms #977
Comments
Updated by tgelf on 2012-05-16 18:06:17 +00:00 I digged a little bit farther, as this seemed pretty strange to me. Found the related commit: https://git.icinga.org/?p=icinga-core.git;a=commitdiff;h=8c071d12cc5cb3a4f2a51d7fd3ee9812c476a992 Not only hostgroup_members have been affected, also a few other important indexes have been removed. At least the following ones make sense to me and shall be restored - but please give them a new name: icinga_contactgroup_members: icinga_hostgroup_members: icinga_host_contactgroups: icinga_host_parenthosts: icinga_servicegroup_members: icinga_service_contactgroups: The commit shown before also affects other DB backends, please have a look at them too. I guess that what you wanted to achieve was removal of useless instance_id indexes (makes sense), but all of those named above didn't have any relation to the instance_id. No idea how they got such name. This could have been the root cause of the massive performance drop experienced with version 1.5 in large Icinga-Web installations, notably in summaries and historic grids involving hostgroups (affects all those with hostgroup permissions) and contacts (notification history). They have been and still are terribly slow. This is at least true for 1.6, please note that I didn't test 1.7 in large environments yet. Regards, |
Updated by mfriedrich on 2012-05-16 18:10:53 +00:00 the goal was to get rid of unique constraints, which would prohibit the changed multiline inserts in the code and query diff. if you require the implicit indexes back in the game, name them accordingly. |
Updated by tgelf on 2012-05-16 18:14:20 +00:00 I found some more constructs as the following one:
As noted in the initial comment (hostgroup-specific), this is completely useless - but slows INSERTs (and UPDATEs?) down, as each indexes has to be refreshed each time. A primary key is always UNIQUE - please remove all those UNIQUE KEYs. But please take care, remove only similar ones, not all of them ;-) |
Updated by tgelf on 2012-05-16 18:36:33 +00:00 Hi Michael, thank you for your fast response! Well, if you wanted to remove the UNIQUEness of those columns the right way would have been to replace UNIQUE KEY with KEY (or CREATE INDEX). It would be great if you could restore at least the dropped indexes, if uniqueness is not an option anymore. However, I can immagine no reason why those UNIQUE KEYs shall break multiline inserts. Duplicates in those member-tables shall never happen. Unfortunately they seem to do so in some rare situations. Today I stumbled over an installation with icinga-core 1.6.1-2 from Ubuntu 12.04, they had >200.000 entries in icinga_hostgroup_members, with most of them having hostgroup_id=0. This wouldn't have happened if those UNIQUE constraints had still been in place. Blind guess: the fact that they have been an issue once may mean that they showed that there is something missbehaving. FYI, here some settings from that installation: data_processing_options=66977597 IMHO the best solution would be trying to find out WHY ido2db had problems with those indexes. Otherwise at least the indexes (without setting them UNIQUE) shell be restored. But please consider the former option, allowing duplicates in member tables is IMO not sane. Cheers, |
Updated by mfriedrich on 2012-05-18 12:08:10 +00:00 well not letting the config tables cleaned on startup is your really own problem, that was not the scope when allowing that feature request to make sure that everything is truly unique probably those indexes itsself must be re-added, but yet i am not really convinced that the unique constraint works as well, as the "insert on duplicate key update" query is not in place anymore. |
Updated by tgelf on 2012-05-20 15:12:29 +00:00 dnsmichi wrote:
Definitively!
IMO there is no valid reason for allowing such duplicates, neither with nor without those fantastic ON-DUPLICATE constructs. If ido2db stumbles over these contraints it would be great if we could find out, WHY it does so. Tt definitively shouldn't. Cheers, |
Updated by mfriedrich on 2012-05-20 16:04:19 +00:00
not in 1.7 tree then. such things require extensive testing.
fantastic? you are kidding right? those statements are the pure evil, as not in sql spec and therefore not portable to postgresql or oracle. that mess did cost me weeks of my life to figure out and write the very correct queries for all rdbms supported. so please do not call them 'fantastic'.
mhm. test again with postgresql or oracle please. mysql is not the real problem, making things too easy aside from the sql specs. |
Updated by tgelf on 2012-05-20 16:42:39 +00:00 dnsmichi wrote:
The indexes themselves as well? What about re-adding the indexes and postponing the decision related to the uniqueness of those indexes?
Of course I am. They are an alluring toy for lazy developers.
A little bit of sarcasm sometimes doesn't hurt ;-)
Unfortunately I haven't available neither one nor the other, I'll try to find someone who has. The indexes alone without the unique contraint obviously won't hurt there. If you've had problems with the constraint before 1.5 there may probably be some issue in ido2db. Therefore I strongly agree on postponing that decision, some intensive testing is required first. But it would be great to see the indexes for those m:n tables being re-added. Regards, |
Updated by robe on 2012-08-25 16:13:38 +00:00
tgelf wrote:
This is adressed in #3018 |
Updated by robe on 2012-08-25 16:15:54 +00:00 Thomas - can you show me the diff between the upstream schema and the one you use in production? I'm interested in which indexes are necessary for icinga-web to perform in large setups. We can easily readd them, I just want to have some documentation on why they're necessary. |
Updated by mfriedrich on 2012-09-16 14:26:00 +00:00
attached is the diff which did cause that probably. |
Updated by mfriedrich on 2012-09-16 14:26:40 +00:00
any possible patch from your side? |
Updated by mfriedrich on 2012-09-16 15:43:46 +00:00 related to #1110 |
Updated by mfriedrich on 2012-09-17 12:20:41 +00:00
i've nailed that down to the following pretty much generic re-add of indexes (oracle - wipe table prefix)
|
Updated by mfriedrich on 2012-09-17 12:21:29 +00:00
|
Updated by mfriedrich on 2012-09-17 12:27:39 +00:00 oh well, oracle will of course use the script defined tablespace for the indexes in that case, and not just put that into the main tablespace.
|
Updated by mfriedrich on 2012-09-17 12:34:31 +00:00
|
Updated by mfriedrich on 2012-09-17 16:20:03 +00:00
now up in next, master, r1.8 for testers. |
Updated by mfriedrich on 2012-09-23 09:57:00 +00:00
|
Updated by mfriedrich on 2014-12-08 14:37:43 +00:00
|
This issue has been migrated from Redmine: https://dev.icinga.com/issues/2618
Created by tgelf on 2012-05-16 17:38:53 +00:00
Assignee: mfriedrich
Status: Resolved (closed on 2012-09-23 09:57:00 +00:00)
Target Version: 1.8
Last Update: 2014-12-08 14:37:43 +00:00 (in Redmine)
The hostgroup_members table is important for Hostgroup-based permissions and has therefore a strong impact on the performance of many Icinga-Web installations. Here a few suggestions:
Cheers,
Thomas Gelf
Attachments
Changesets
2012-09-17 12:27:51 +00:00 by mfriedrich 6f37cd7
Relations:
The text was updated successfully, but these errors were encountered: