[MDEV-15415] there is no combination of innodb variables that would force update table_rows count Created: 2018-02-24 Updated: 2018-10-05 Resolved: 2018-10-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2.13 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Philip orleans | Assignee: | Unassigned |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Environment: |
centos 7 |
||
| Description |
|
even if I set
nothing at all forces analyze table to accurate update the field table_rows in information_schema.tables, and there is no known way to user-update that field, which is certainly a solution. I need that field to be 100% accurate because I use that number to retrieve a random row on a large table, and there is no fastest way than doing RAND()*table_rows. The tables never change. Now I do "analyze table" after loading the data from scratch once a month. |
| Comments |
| Comment by Elena Stepanova [ 2018-03-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
How large is the large table, and how far off is the count?
(replace '<database/table>' with actual names). Please also attach your complete cnf file, maybe something else in there affects the outcome. On a separate note, if tables never change, you don't actually need INFORMATION_SCHEMA for row counts, you can store them right when you load the tables. Moreover, you probably don't need InnoDB either, and MyISAM could give you a simple and more accurate row count. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip orleans [ 2018-03-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In reality there are 425 tables in tha database. This is the largest table with 9MM rows. The data is randomized prior to inserting it and the ID field is the primary key, an auto-increment number. Then each time I read the table to extract a random row, I multiply RAND()*table_rows. There is no faster way to retrive a true random record. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-10-04 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Could you please give an example of the table structure, and also provide the complete config file (or show global variables)? I can't reproduce it, I'm getting the exact number of rows with your stat options:
etc. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip orleans [ 2018-10-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Please close the case, I cannot reproduce it myself. |