DEV Community

loading...

Discussion on: When is it a good idea to use stored procedures?

Collapse
dmfay profile image
Dian Fay

Absolutely use procs:

  • for ETL (extract-transform-load data into the db) jobs
  • for other database ops tasks
  • with triggers

Consider using procs:

  • any time you'd be shuttling a ton of data over the wire only to do something to it then put it back (eg cloning a relationship graph)
  • to perform simple tasks that lend themselves well to SQL

Don't use procs:

  • when you're worried about compatibility between different DBMSs
  • when what you're doing is subject to change extremely quickly