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

  • Home
  • SEARCH
  • 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 5943691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:25:54+00:00 2026-05-22T16:25:54+00:00

We started using statement-based replication, and found that it breaks SQL_CALC_FOUND_ROWS and FOUND_ROWS(), and

  • 0

We started using statement-based replication, and found that it breaks SQL_CALC_FOUND_ROWS and FOUND_ROWS(), and I’m looking for a work around. A comment from a bug report in 2007 suggests using SELECT SQL_CALC_FOUND_ROWS INTO @found_rows FROM foo, but that doesn’t seem to work. MySQL says the syntax is invalid.

  • 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-22T16:25:55+00:00Added an answer on May 22, 2026 at 4:25 pm

    If you’re using an older version of MySQL, that could be part of your problem: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_found-rows

    FOUND_ROWS() is not replicated
    reliably using statement-based
    replication. Starting with MySQL
    5.1.23, this function is automatically replicated using row-based
    replication.

    Edit: The above only works if you’re in MIXED mode.

    Also, the correct workaround syntax is:

    SELECT SQL_CALC_FOUND_ROWS * FROM foo;
    SET @found_rows = FOUND_ROWS();
    

    SQL_CALC_FOUND_ROWS doesn’t return anything, it just tells MySQL to calculate the number of found rows from the query, even if a LIMIT clause prevents all of them from being returned to the client. FOUND_ROWS() can then be used to return the value that was temporarily stored by SQL_CALC_FOUND_ROWS.

    Edit: The idea behind the above workaround (as documented in MySQL bug 12092):

    The result of FOUND_ROWS() is stored
    into a user variable and used that
    way instead. This will replicate
    correctly even under statement-based
    replication, since it will write a
    User_var entry to the binary log.

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

Sidebar

Related Questions

We started using Multi-Master Replication Manager for MySQL, and I am wondering whether it
I started using Zend_Paginator, it works everything fine but I noticed that there is
so I have started using Subversion and am confused about the ignore files. From
I have recently started work on a project that has already been running for
Commonly when I look around the Internet, I find that people are generally using
I started using subversion for one of my projects and it would be absolutely
I started using NetBeans for Python development, and so far it looks pretty good.
I started using Sandcastle some time ago to generate a Documentation Website for one
I started using Core Data for iPhone development. I started out by creating a
I started using bundler (which is to my eyes a pure disaster). Now 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.