Processes get added to db in one big query instead of individual inserts. #1447

Merged
merged 2 commits into from Jul 15, 2015

Projects

None yet

4 participants

@spinza
Contributor
spinza commented Jul 14, 2015

When polling unix agent processes we add the processes to the db in one large query instead of an individual query for each of them. Reduces the time taken.

@spinza
Contributor
spinza commented Jul 14, 2015

All escaped.

@paulgear
Member

This looks OK to me, although I wonder whether we wouldn't get the same performance by simply wrapping this in a begin/commit block.

@spinza
Contributor
spinza commented Jul 15, 2015

@paulgear are you wondering or do you know? It would be good if it worked as I was going to tackle the package code next as it is similarly using individual inserts and deletes. Though that code is a bit more complex.

Just found this: https://dev.mysql.com/doc/refman/5.7/en/insert-speed.html
Not sure if the transaction will help as it is still multiple connections or have I got it upside down?

@spinza
Contributor
spinza commented Jul 15, 2015

I actually should write a dbFacile dbInsertBulk, dbDeleteBulk and dbUpdateBulk functions for this. These could take table name, field headers, primary key and a array for the data as parameters? We could then optimise there?
Next PR?

spinza added some commits Jul 14, 2015
@spinza spinza Processes get added to db in one big query instead of individual row …
…inserts.
605d92b
@spinza spinza Escape values passed to query.
f261b7b
@spinza
Contributor
spinza commented Jul 15, 2015

Rebased.

@f0o f0o merged commit 6457584 into librenms:master Jul 15, 2015

2 checks passed

Auto-Deploy Build finished.
Details
Scrutinizer No new issues
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment