Pt-upgrade - Does it sort rows before comparing?

Hi,

Been looking at pt-upgrade recently, running it against a couple of test systems.

It’s reported “Row diffs: 3” on a couple of runs.

Does ‘pt-upgrade’ sort data it gets back before comparing rows? - I’m just wondering as the original query has no ORDER BY and looks like it might be returning the same rows, in different orders on both servers (the client doesn’t care about this as it’s just iterating the whole lot).

But just wondered if lack of ORDER BY if it results in a difference in row orders is going to upset pt-upgrade, or whether it orders the rows effectively before it ‘diffs’ them?

Thanks,

-Karl

1 Like

Hello, pt-upgrade does not sort results. This is on purpose to detect queries that return results in different sort order. You should never rely on default ordering, but specify explicit ORDER BY if you need it.

1 Like

Hi,

Thanks for the quick reply - I think this came about because the query being run is iterated through in it’s entirety every time by the client - so order didn’t really come into this case.

However ‘pt-upgrade’ is correct obviously to point out the differing order - so we’ll be adding ORDER BY to these queries to resolve that (and will try to remember going forward :slight_smile: )

Thanks!

1 Like