0

I have a simple query select * from table1 limit 5 on a large table but it stucks at "sending data". There is only one connection.

Here's the describe query:

+----+-------------+----------------+------------+------+---------------+------+---------+------+-----------+----------+-------+
| id | select_type | table          | partitions | type | possible_keys | key  | key_len | ref  | rows      | filtered | Extra |
+----+-------------+----------------+------------+------+---------------+------+---------+------+-----------+----------+-------+
|  1 | SIMPLE      | table1         | NULL       | ALL  | NULL          | NULL | NULL    | NULL | 177400355 |   100.00 | NULL  |
+----+-------------+----------------+------------+------+---------------+------+---------+------+-----------+----------+-------+

And SHOW GLOBAL STATUS LIKE 'innodb%'

+---------------------------------------+------------------------------------+
| Variable_name                         | Value                              |
+---------------------------------------+------------------------------------+
| Innodb_buffer_pool_dump_status        | Dumping of buffer pool not started |
| Innodb_buffer_pool_load_status        | Loaded 139265/260068 pages         |
| Innodb_buffer_pool_resize_status      |                                    |
| Innodb_buffer_pool_pages_data         | 1016643                            |
| Innodb_buffer_pool_bytes_data         | 16656678912                        |
| Innodb_buffer_pool_pages_dirty        | 753432                             |
| Innodb_buffer_pool_bytes_dirty        | 12344229888                        |
| Innodb_buffer_pool_pages_flushed      | 544507                             |
| Innodb_buffer_pool_pages_free         | 7999                               |
| Innodb_buffer_pool_pages_misc         | 23870                              |
| Innodb_buffer_pool_pages_total        | 1048512                            |
| Innodb_buffer_pool_read_ahead_rnd     | 0                                  |
| Innodb_buffer_pool_read_ahead         | 210478                             |
| Innodb_buffer_pool_read_ahead_evicted | 0                                  |
| Innodb_buffer_pool_read_requests      | 234500180                          |
| Innodb_buffer_pool_reads              | 648513                             |
| Innodb_buffer_pool_wait_free          | 0                                  |
| Innodb_buffer_pool_write_requests     | 104348100                          |
| Innodb_data_fsyncs                    | 21149                              |
| Innodb_data_pending_fsyncs            | 0                                  |
| Innodb_data_pending_reads             | 1                                  |
| Innodb_data_pending_writes            | 0                                  |
| Innodb_data_read                      | 29893923328                        |
| Innodb_data_reads                     | 1765288                            |
| Innodb_data_writes                    | 731140                             |
| Innodb_data_written                   | 13111207936                        |
| Innodb_dblwr_pages_written            | 0                                  |
| Innodb_dblwr_writes                   | 0                                  |
| Innodb_log_waits                      | 0                                  |
| Innodb_log_write_requests             | 2982120                            |
| Innodb_log_writes                     | 1646                               |
| Innodb_os_log_fsyncs                  | 1773                               |
| Innodb_os_log_pending_fsyncs          | 0                                  |
| Innodb_os_log_pending_writes          | 0                                  |
| Innodb_os_log_written                 | 1170811392                         |
| Innodb_page_size                      | 16384                              |
| Innodb_pages_created                  | 34                                 |
| Innodb_pages_read                     | 1745291                            |
| Innodb_pages_written                  | 729507                             |
| Innodb_row_lock_current_waits         | 0                                  |
| Innodb_row_lock_time                  | 0                                  |
| Innodb_row_lock_time_avg              | 0                                  |
| Innodb_row_lock_time_max              | 0                                  |
| Innodb_row_lock_waits                 | 0                                  |
| Innodb_rows_deleted                   | 0                                  |
| Innodb_rows_inserted                  | 0                                  |
| Innodb_rows_read                      | 10                                 |
| Innodb_rows_updated                   | 0                                  |
| Innodb_num_open_files                 | 36                                 |
| Innodb_truncated_status_writes        | 0                                  |
| Innodb_available_undo_logs            | 128                                |
+---------------------------------------+------------------------------------+

What is wrong?

Edit: changed the table name to avoid confusion.

Here is the my.cnf setup:

innodb_buffer_pool_size = 16G
innodb_log_buffer_size = 4G
innodb_log_file_size = 4G
innodb_write_io_threads = 32
innodb_flush_log_at_trx_commit = 0
innodb_doublewrite = 0
innodb_change_buffer_max_size = 50
innodb_data_file_path = ibdata1:10M:autoextend
query_cache_limit = 0
query_cache_size = 0
query_cache_type = 0
16
  • 1
    FYI, without an ORDER BY or WHERE clause, TOP is just going to return random rows from the entire table, which seems nonsensical. Are you sure that's what you want?
    – J.D.
    Oct 24, 2022 at 3:28
  • Is that the entire query? Is table really a VIEW? Are there any Triggers?
    – Rick James
    Oct 24, 2022 at 4:13
  • @J.D. Yes I understand that. But even with such a simple query it takes too long. So suspect there is something wrong.
    – cccfran
    Oct 24, 2022 at 15:07
  • @RickJames Sorry for the confusion. table is the just table name by itself. I changed it to table1 to clear the confusion. Thanks.
    – cccfran
    Oct 24, 2022 at 15:09
  • 1
    @cccfran - Hmmmm... The query is so simple that I see no way for it to take more then even 1 second. I expect it to read the data's BTree from the start, and quit after sending 5 rows. (The big number in "Rows" in the EXPLAIN is bogus.) Another question... Was anything else running when this happened. (Example: a backup.)
    – Rick James
    Oct 24, 2022 at 15:44

1 Answer 1

0

@cccfran Please set variables 'query_cache_limit = 0' 'query_cache_size = 0' and 'query_cache_type = 0' in [mysqld] section of your mysql server configuration

2
  • Thanks! But it does not really work.
    – cccfran
    Oct 24, 2022 at 15:07
  • @cccfran Can you please give the actual query you are trying to run by aliasing the original table/column names?
    – Sarma MV
    Oct 24, 2022 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.