[MDEV-10560] Different results when change select in simple query Created: 2016-08-15 Updated: 2016-08-16 Resolved: 2016-08-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.1.16 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | masoud sabaghi | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | upstream | ||
| Attachments: |
|
| Description |
|
Hi Also when i run this queries The table is exist in attachment. |
| Comments |
| Comment by Daniel Black [ 2016-08-16 ] |
|
which server version are you running? Adding first_name as an additional key would also help speed up these queries. edit: removed PK suggestion - it was at end of sql. |
| Comment by masoud sabaghi [ 2016-08-16 ] |
|
Version 10.1.16 but id had this problme on mysql 5.6 too |
| Comment by Elena Stepanova [ 2016-08-16 ] |
|
You are ordering the result set by a non-unique column. You can only expect that if first_name_1 < first_name_2, then all rows with first_name_1 will come earlier (in case of ASC) or later (in case of DESC) than all rows with first_name_2. There is nothing that guarantees any specific order inside a group with the same first_name. Technically, you can even get different results running the same query, e.g. one with LIMIT 20 OFFSET 0, although in practice it rarely happens; and of course, the second query knows nothing about the previous query. If your next argument is "it used to work on 5.5" – yes, it might well be true, but it worked by pure luck, the behavior has never been defined and guaranteed. See also https://bugs.mysql.com/bug.php?id=69732 for longer discussion. |