top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

MySQL Descending ORDER issue

+1 vote
233 views

I am currently upgrading from mysql 5.1.72 -> mysql 5.6 and the migration and upgrade is sound (In a QA ENV). Queries work etc. However, when I run a query similar to "SELECT table.* FROM table WHERE (some_id IN (13528, 14906, 38845)) ORDER BY date DESC LIMIT 1;" on 5.1.72 and on 5.6.15 I get back different data. The date for all of the data are exactly the same to the second.

However, if I run "SELECT table.* FROM table WHERE (some_id IN (13528, 14906, 38845)) ORDER BY date LIMIT 1;" it comes back with the exact same data that is expected. Is this a bug? Or am I missing here?

posted Dec 27, 2013 by Luv Kumar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

It's probably a difference in the optimizer or the query engine between 5.1 and 5.6. Since you only specified "ORDER BY date", mysql is free to return rows with the same date value in any order, even on consecutive runs within the same session if it wants to. If you need a stable sort every time, you'll need to add another column to your ORDER BY clause. id might be a good choice (since it's your primary key for that table), or credential_id (since you're using that in your WHERE clause already).

answer Dec 27, 2013 by Kumar Mitrasen
Similar Questions
+3 votes

I upgraded to fedora 20 from fedora 19 using fedup. Everything went well except for some weird issues with Thunderbird. The latter is now giving me a pile of weird permission errors and disk space errors. There is 250GB free space, so I know that is not the problem. Obviously this has something to do with the permissions on the thunderbird folder, but I do not have the knowledge to rectify the problem.

Please suggest how to proceed?

+1 vote

I have 2 mysql 5.0.45 installations on one RHEL server. One live mysqld is setup in what appears to be a relatively standard installation, port 3306, user 'mysql', etc. I've set up the other mysqld to run tests on a non-standard port 5045, user 'testsql', different data root, config, logs, etc.

When I attempt to connect to the mysqld running on port 5045 from the command-line mysql client on the same host as follows ...

# mysql -P 5045

... it seems I'm actually connecting to the live server on 3306 because 'show databases' shows the live databases. How can I troubleshoot this best?

+1 vote

For Example:
the prime divisors of 450 are 4,5,3,3,2.

+1 vote

After upgrading from Fedora 24 to Fedora 25 I found I couldn't login to my home directory. What I could do was login as root.
Has anybody had this same problem?

...