3

http://www.percona.com/ppc2009/PPC2009_Boring_MySQL.pdf:

Don't do work in the database if you can do it elsewhere

I must say I don't quite understand this statement. Can someone elaborate on it?

Does it mean the we should enforce integrity on the application level instead of at the database level?

Or does it mean something else completely?

houyi77
  • 153
  • 5
  • 1
    I have to disagree with the statement... I always try to do data-related work as close to the stored data as possible, so most of the time in the database itself. And I think that works great. – Maximilian Mayerl Jul 13 '11 at 08:56

2 Answers2

6

We have no way of knowing. The only person who knows what he meant by that is the author, Baron Schwartz. A quick scan of his slides suggests he isn't an idiot, so I'm pretty sure he doesn't mean enforce integrity in the application not the database. He probably means don't overload the database with other processing that can be done more efficiently elsewhere.

Tony Andrews
  • 129,880
  • 21
  • 220
  • 259
1

Dont add business logic to the db if you can do it at the application level.

Database should be used as its name implies - to store data.

As a general rule of thumb, try keeping all logic in there to a minimum, otherwise your application becomes harder to maintain and more bug prone.

ravyoli
  • 698
  • 6
  • 13
  • 1
    Define business logic. SUM(value) aka balance= 0 before setting another column? This is a stored procedure to avoid round trips, or a SQL operation. Your answer is a useless cliché – gbn Jul 13 '11 at 09:23