-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clean bulk upsert optimization #89
Conversation
queryInterface.addIndex( | ||
'Samples', | ||
['name'], | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to remove this? Seems like a good thing to have around regardless, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would hurt us to have extra indexes.
See: http://stackoverflow.com/questions/20707182/disadvantages-of-creating-multiple-indexes-in-a-postgresql-table
indexes have a performance penalty when it comes to INSERTing new rows, DELETEing old ones or UPDATEing existing values of the indexed column, as now the DML statement need not only modify the table's data, but the index's one too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
(... although I could argue that with our usage pattern there wouldn't actually be a penalty for indexing name because samples rarely get created or deleted, and when they're updated, the name is typically not updated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. I see your point. I can add the index back in if @shriramshankar has no issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://devcenter.heroku.com/articles/expensive-queries. Looks like unused indexes could also be a cause of slow DML operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok get rid of it
No description provided.