[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate query execution in inline SQL textarea #12653

Closed
speller opened this issue Oct 20, 2016 · 3 comments
Closed

Duplicate query execution in inline SQL textarea #12653

speller opened this issue Oct 20, 2016 · 3 comments
Assignees
Labels
question Used when we need feedback from the submitter or when the issue is a question about PMA

Comments

@speller
Copy link
speller commented Oct 20, 2016

Steps to reproduce

  1. Press the "edit inline" link and go to the inline query textarea
  2. Enter long-time a query and execute it
  3. Check the SHOW PROCESSLIST command on the server.

Expected behaviour

Entered query executed only once

Actual behaviour

Entered query executed twice. First - with added LIMIT, second - with added SQL_CALC_FOUND ROWS and LIMIT.

Server configuration

Operating system: Linux

Database: MySQL 5.5

PHP version: 5.6

phpMyAdmin version: 4.6.4

Client configuration

Browser: Chorme

Operating system: Windows 7 x64

Description:

Source query:

select count(*) from goods_prices_view_v11 where delivery_id = 18

When I execute this long-time query I see its double execution in the mysql's SHOW PROCESSLIST command:

First:

+-----------+-----------+---------------------+--------------+---------+------+--------------+------------------------------------------------------------------------------------------------------+-----------+---------------+-----------+
| Id        | User      | Host                | db           | Command | Time | State        | Info                                                                                                 | Rows_sent | Rows_examined | Rows_read |
+-----------+-----------+---------------------+--------------+---------+------+--------------+------------------------------------------------------------------------------------------------------+-----------+---------------+-----------+
| 106981084 | user      | ****:54942          | db_name      | Query   |   11 | Sending data | select count(*) from goods_prices_view_v11 where delivery_id = 18 LIMIT 0, 25                        |         0 |             0 |         0 |

Second:

+-----------+-----------+---------------------+--------------+---------+------+--------------+-------------------------------------------------------------------------------------------------+-----------+---------------+-----------+
| Id        | User      | Host                | db           | Command | Time | State        | Info                                                                                            | Rows_sent | Rows_examined | Rows_read |
+-----------+-----------+---------------------+--------------+---------+------+--------------+-------------------------------------------------------------------------------------------------+-----------+---------------+-----------+
| 106981084 | user      | ****:54942          | db_name      | Query   |   45 | Sending data | SELECT SQL_CALC_FOUND_ROWS count(*) from goods_prices_view_v11 where delivery_id = 18 LIMIT 1   |         0 |             0 |         0 |

@devenbansod
Copy link
Member

I think this is as expected.

The first query returns the actual results to be outputted (with LIMIT clause added according to $cfg['MaxExactCount'] (default 25) ), while we use the second query to later use SELECT FOUND_ROWS() to find the total rows (if the query had been run without the LIMIT clause).
Ref : http://dev.mysql.com/doc/refman/5.7/en/information-functions.html#function_found-rows

@devenbansod devenbansod added the question Used when we need feedback from the submitter or when the issue is a question about PMA label Nov 5, 2016
@speller
Copy link
Author
speller commented Nov 8, 2016

Is it possible to turn this duplication off? I have slow DB connection and sometimes I need to execute slow queries, so it become very inconvenient to do in PHPMyAdmin.

@nijel
Copy link
Contributor
nijel commented Feb 13, 2017

AFAIK you can disable by setting $cfg['MaxExactCount'] to 0.

@nijel nijel self-assigned this May 9, 2017
@nijel nijel closed this as completed May 9, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Used when we need feedback from the submitter or when the issue is a question about PMA
Projects
None yet
Development

No branches or pull requests

3 participants