A SQL select with no order by clause means that you will get the rows
back but the order is not guaranteed.
The fact that other storage engines or Databases always return the same
order is not a requirement of SQL.
So random order of rows is not a violation of the SQL standard.
In most storage engines the fastest way to access the data is usually
more or less the same. In Myisam start from the top of the file and read
rows, in innodb, start reading data pages from the beginning and you get
rows in primary key order.
In cluster/ndb you get rows in the order that the ndb node that is
coordinating the transaction receives them. The order that the ndb nodes
get them depends on many things.
--
Tom
ch huang wrote:
> i set the two cluster ,2 host for master-slave cluster,another is NDB,i want
> put all data on M-s to NDB,so i let one SQL node to point to the MASTER
> server,but i find the data in NDB is not the same order with it in M-s
> cluster,
> IN m-s cluster
>> select * from t_for_script
> | 125 | test1 | 2009-10-27 06:20:01 |
> | 126 | test1 | 2009-10-27 06:30:01 |
> | 127 | test1 | 2009-10-27 06:40:01 |
> | 128 | test1 | 2009-10-27 06:50:01 |
> | 129 | test1 | 2009-10-27 07:00:01 |
> | 130 | test1 | 2009-10-27 07:10:01 |
> | 131 | test1 | 2009-10-27 07:20:01 |
> | 132 | test1 | 2009-10-27 07:30:01 |
> | 133 | test1 | 2009-10-27 07:40:01 |
> | 134 | test1 | 2009-10-27 07:50:01 |
> | 135 | test1 | 2009-10-27 08:00:01 |
> | 136 | test1 | 2009-10-27 08:10:02 |
> | 137 | test1 | 2009-10-27 08:20:01 |
> | 138 | test1 | 2009-10-27 08:30:01 |
> | 139 | test1 | 2009-10-27 08:38:04 |
> +-----+-------+---------------------+
> 139 rows in set (0.00 sec)
>
> in NDB
>> select * from t_for_script
>
> | 45 | test1 | 2009-10-26 17:00:01 |
> | 127 | test1 | 2009-10-27 06:40:01 |
> | 96 | test1 | 2009-10-27 01:30:01 |
> | 78 | test1 | 2009-10-26 22:30:01 |
> | 38 | test1 | 2009-10-26 16:13:51 |
> | 98 | test1 | 2009-10-27 01:50:01 |
> | 104 | test1 | 2009-10-27 02:50:01 |
> | 137 | test1 | 2009-10-27 08:20:01 |
> | 58 | test1 | 2009-10-26 19:10:01 |
> | 71 | test1 | 2009-10-26 21:20:01 |
> | 114 | test1 | 2009-10-27 04:30:01 |
> | 33 | test1 | 2009-10-26 16:00:01 |
> | 129 | test1 | 2009-10-27 07:00:01 |
> | 49 | test1 | 2009-10-26 17:40:01 |
> | 128 | test1 | 2009-10-27 06:50:01 |
> +-----+-------+---------------------+
> 110 rows in set (0.00 sec)
>
> is this cause problem in use??,and why the order is so mess? and i get the
> same result when i run select statement again,the same order,so strange...
>