Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6783679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:53:46+00:00 2026-05-26T16:53:46+00:00

MySQL Stored Procedure Programming by Guy Harrison in the Triggers chapter says that triggers

  • 0

“MySQL Stored Procedure Programming” by Guy Harrison in the Triggers chapter says that triggers is the way to go to maintain a summary table.

The summary table in the example here is a table which stores a total value of sales for a customer. This data is derived from a ‘sales’ table which records individual transactions. The example uses uses BEFORE INSERT, BEFORE UPDATE and BEFORE DELETE triggers on the ‘sales’ table to keep ‘customer_sales_totals’ table in sync. The BEFORE INSERT trigger performs a select on the ‘customer_sales_totals’ table and inserts a row there or updates an existing one.

Now, let’s assume that:

  • there are tens/hundreds of thousands records inserted into the ‘sales’ table each day;
  • it is enough if the ‘customer_sales_totals’ is never out of date by more then few minutes;
  • there a many sales for each customer (the number of sales is much bigger than the number of customers).

In this scenario would a periodic low priority job rather than triggers be a more efficient way of maintaining the ‘customer_sales_totals’?

Thanks
Tymek

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:53:47+00:00Added an answer on May 26, 2026 at 4:53 pm

    I personally favor the periodic job option for the sake of maintenance. The code is located in one place, can be more easily documented, and tests can be carried out more easily.
    Now, I know that triggers have their fans and it is certainly more subtle, although in my opinion it lead to split the code in too many pieces. In real daily work life this means you need an expert to look at it, so less flexibility in organizing your staff and more head scratching when you hit a bug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL stored procedure that uses a temporary table. Assume that my
I've got a mySql stored procedure that looks like this-- delimiter | create procedure
Well I have this MySQL stored procedure that I wrote and if I run
I have a MYSQL stored procedure SP1() that returns a result set. I want
I'm trying to pass a table name into my mysql stored procedure to use
I have a java program that is calling a MySQL stored procedure that is
Can a MySql stored procedure / function return a table without the use of
I would like to create a stored procedure in MySQL that took a list
I'm (attempting) to write a MySQL stored procedure that parses a large text file.
Is it possible that a MySQL function/stored procedure returns a query result? Because I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.