-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
WIP testing enum as part of PK #277
Conversation
reference: #273 enum values are intentionally not alphabetically monotonic
At this time the test fails, suggesting we suffer from the
Note the very first two rows. |
Fixed, via casting
|
DO NOT MERGE at this time |
all tests pass at this time |
sent to testing in prod |
Or use 0+enum_col. |
Sorry, can you please explain? |
I meant it like this:
|
Sorry, I still don't follow: is this a suggestion to the user on how to use an |
I presumed that the numeric enum-casting is needed for writing the new table in perfect PK-order. |
@druud62 got it. The problem this actually reverse. We need to intentionally convert the enum to See more on https://bugs.launchpad.net/percona-toolkit/+bug/1613915/comments/1 |
In the nibbler of our internal table-clone tool, we do something like this:
|
I see. One difference between your implementation and
At the end of the day, whether we continue doing this as implemented by this PR ( There may be a lead in your previous comment that's worth investigating. I'd need a clear time to switch context into this to give it more thought. |
The "FORCE INDEX (PRIMARY)" is mainly there to retrieve the right rows in the right order. Yes, with enums in the PK this approach needs a table scan. We store the starting-PK of each chunk, and use that list to process the chunks. No need to store the last tuple too. We also tried this https://dev.mysql.com/doc/refman/5.7/en/handler.html The real PK of a table like this, would in many cases be an id++, with either a uniq (e_id, e_grp), or with a uniq (e_grp,e_id) and a key (e_id). |
|
I don't remember ever having seen it ignore a FORCE INDEX(). Idem IGNORE INDEX(). It does ignore 'USE INDEX()' hints, which generally works out good, providing that the table statistics aren't too old. (Makes me remember that I have to re-instate the ANALYZE LOCAL TABLE cronjob, that ran locally on all our mysql/maria/etc. boxes, as we recently found more tables with old table stats. The job touches each table once or twice per week, which really helps.) |
From the docs:
Less of an issue here, but I would still be explicit re: ordering in SQL statements, including for the human readability aspect.
I'm not sure how concerned we are about that, @druud62 -- though I don't recall talking to @shlomi-noach about it. We're copying rows while also parsing and playing real time writes to the table, so it wouldn't be in perfect PK order. And if there's a desire for parallel copy that wouldn't be in perfect order either. Unless there's a problem with the current implementation, I think we should close this and work on fixes that have more impact or performance improvement. |
I'm a bit naive on this, but what does this mean? What are the pros/cons in terms of performance or data consistency/reliablity where that applies? As far as I understand, it doesn't matter what order data is written, MySQL will still cluster the data on disk based on the choice and value of the Primary Key (something I've had to change on large tables in order to cluster data more effectively for reads). Also known as a clustered index. |
reference: #273
enum
values are intentionally not alphabetically monotoniccc @ggunson