Reading through to this i have just learned the presence of the
blackhole table trick: essentially consist in making use of just one table to place data, after which a trigger that split the information in lots of other tables.
Im wondering if the might cause problems, when the designers whos focusing on the project know that.
Do you know the professional and cons of the tecnique?
The blink I acquired in your mind after i saw the example, is all about transactions: if for whatever reason the transaction fail, you will find the
blackhole row using the original data, for historic purpose and perhaps a assist with debug - but this appears to be the sole +1 i can tell with blackholes. Ideas?
I do not think blackhole has any real pros.
Writing the trigger code to maneuver data around is most likely not noticably less work than writing the code to place the information in the best place to begin with.
As Christian Oudard creates, it does not reduce complexity - just moves it to some place where it is tough to debug.
Around the downside:
"Unwanted effects" are generally a bad idea in software development. Triggers are unwanted effects - I plan to do one factor (place data inside a table), also it really does all things. Now, when I am debugging my code, I must keep all of the unwanted effects during my mind too - and also the unwanted effects could themselves have unwanted effects.
most software stays much more amount of time in maintenance of computer does in development. Getting new designers in to the team and explaining the black hole trick will probably boost the learning curve - for minimal benefit (in my opinion).
Because triggers are unwanted effects, and it is relatively simple to create off an enormous cascade of triggers if you are not careful, I have always attempted to create my databases with no reliance upon triggers where triggers are clearly the proper way to go, I have only let my most experienced designers create them. The black hole trick makes triggers right into a normal, regular method of working. This can be a personal perspective, obviously.
The original question that motivated yours doesn't get in the centre of MySQL's "blackholes."
Exactly what is a BLACKHOLE?
BLACKHOLE is really a storage engine that merely discards all data Placed in it, similar to some null device. You will find numerous good reasons to make use of this after sales, however they are usually a little abstruse:
- A "relay-only" binlog-blocking slave
Begin to see the paperwork, and here and here.
E.g., calculating the overhead of binary logging without worrying about storage engine overhead
- Various computational methods
If you do not know why you'll need a data sink pretending to be a table, avoid using it.
What's the technique you're asking about?
The use in mind appears to become to:
- redirect Placed data with other tables
- audit log the initial INSERTion action
- discard the initial Place data
Thus the response to the question of "evilness" or pros/cons is equivalent to the response to individuals questions for insertable/updatable Sights (the most popular method to implement #1), trigger-based audit logging (how many people do #2) and behavior overrides/counteractions generally (you will find various ways to complete #3).
So, what's the answer?
The reply is, obviously, "sometimes they work and often not." :) Are you aware why you are doing the work? May be the application a much better spot for this functionality? May be the abstraction too brittle, too leaking, too rigid, etc.?
This does not seem like advisable. If you are attempting to keep the front-end code simple, why don't you only use a saved procedure? When not to help keep the front-end code simple, I do not comprehend the point whatsoever.