Comments on: Triggers Use Case Compilation, Part I https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i Blog by Shlomi Noach Tue, 10 Mar 2015 20:36:04 +0000 hourly 1 https://wordpress.org/?v=5.3.3 By: MySQL: Delete a record from all tables in one shot | XL-UAT https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-311642 Tue, 10 Mar 2015 20:36:04 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-311642 […] keys at the moment, otherwise you wouldn’t ask. In which case you may try using triggers, see this post for an example. Triggers are bad for performance, mind […]

]]>
By: Eswar https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-233949 Wed, 19 Mar 2014 11:51:01 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-233949 can we use when clause in mysql triggers?? if Yes, please give me an example.

]]>
By: Impact of foreign keys absence on replicating slaves | code.openark.org https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-91016 Mon, 14 May 2012 05:52:49 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-91016 […] rely on integrity with cascading constraints. An ugly patch might be to use triggers so as to simulate their behavior. Performance wise this is very bad. […]

]]>
By: When are MySQL Triggers not a good idea? | DIGG LINK https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-65679 Mon, 09 Jan 2012 19:11:54 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-65679 […] read the docs, FAQs, Forum and other sites and witnessed plenty of use cases, but haven’t come across a discussion of best […]

]]>
By: SQL: forcing single row tables integrity | code.openark.org https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-15027 Tue, 22 Jun 2010 04:58:57 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-15027 […] Triggers Use Case Compilation, Part I […]

]]>
By: Samuel https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-12339 Sun, 18 Apr 2010 22:52:10 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-12339 @Shlomi,

Kindly appreciate the notice.

The triggers are for insert and update on the reference tables — the master dictionary if you will. Trigger firings, therefore, are extremely rare — the frequency of “discovering” a new word to add. These reference tables are virtually read only.

The more active write tables are strictly no-frills word-usage data collection. No triggers involved.

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-12331 Sun, 18 Apr 2010 06:45:14 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-12331 @Samuel,

With pleasure. Do take notice that triggers will *considerably* slow down your queries. If this is a one time job, for importing data from MSSQL, this may be fine; but make sure to check on your performance if you’re going live with active triggers.

]]>
By: Samuel https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-12329 Sun, 18 Apr 2010 06:34:03 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-12329 Thank you for your generous contribution.

I am in the process of moving a large very specialized linguistic database in MS SQL to MySQL (way cheaper on aws.amazon). Referential integrity was enforced in SQL Server using triggrs that checked the inserted values against views — this was the ONLY way possible given the highly customized way words in this database are categorized (over 400 unique lexical senses). I was beating my head bloody trying to figure out a way to “trick” MySQL into similar functionality, and happily like the song says “then came you!”

Again, thank you for your generosity sharing your knowledge.

]]>
By: Triggers Use Case Compilation, Part III | code.openark.org https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-503 Mon, 02 Feb 2009 11:23:42 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-503 […] Triggers Use Case Compilation, Part III […]

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/triggers-use-case-compilation-part-i/comment-page-1#comment-320 Fri, 16 Jan 2009 05:26:49 +0000 https://shlomi-noach.github.io/blog/?p=313#comment-320 Roland,

thanks for this important correction. I’ve updated the text. I have to check how I came to that conclusion.

In your sample code above, it is best if you specified ENGINE=InnoDB for those who have MyISAM as default storage engine.

When doing the above with MyISAM, no error is ever produced. Moreover, trying to ALTER tables to InnoDB still works fine, since the foreign key was silently dropped as we were using MyISAM. Will check if there’s an open bug on this.

Regards,
Shlomi

]]>