tags:

views:

129

answers:

2
mysql> explain SELECT p.id ID, p.job_desc_title Title, p.url URL, substr(p.posting_date, 1, 10) Date, 
    ->                                         p.job_city_name City,
    ->                                         p.job_state_name State,
    ->                                         b.screen_name Name, b.type Type,f.name Company,IF(g.account_id IS NULL,0,1) Online
    ->                                         FROM postings p
    ->                           LEFT JOIN accounts b on p.account_id=b.id
    ->                           LEFT JOIN companies f on f.id=p.job_cmp_id
    ->                           LEFT JOIN online g ON g.account_id=p.account_id
    ->                           WHERE (MATCH(job_desc,job_desc_title,k_state,k_city,zip) AGAINST('+java' IN BOOLEAN MODE))  AND b.closed=0 AND NOT p.expired 
    ->                           
    ->                           LIMIT 0 , 5
    -> ;
+----+-------------+-------+----------+--------------------------------------------------+--------------------------------------+---------+-----------------+------+-------------+
| id | select_type | table | type     | possible_keys                                    | key                                  | key_len | ref             | rows | Extra       |
+----+-------------+-------+----------+--------------------------------------------------+--------------------------------------+---------+-----------------+------+-------------+
|  1 | SIMPLE      | p     | fulltext | FK_listings,f_postings_city_state_desc_title_zip | f_postings_city_state_desc_title_zip | 0       |                 |    1 | Using where | 
|  1 | SIMPLE      | f     | eq_ref   | PRIMARY                                          | PRIMARY                              | 4       | v3.p.job_cmp_id |    1 |             | 
|  1 | SIMPLE      | g     | eq_ref   | account_id                                       | account_id                           | 4       | v3.p.account_id |    1 | Using index | 
|  1 | SIMPLE      | b     | eq_ref   | PRIMARY                                          | PRIMARY                              | 4       | v3.p.account_id |    1 | Using where | 
+----+-------------+-------+----------+--------------------------------------------------+--------------------------------------+---------+-----------------+------+-------------+
4 rows in set (0.00 sec)

It used to be ordering by relevance,but seems not now.

+4  A: 

Without an order by, the "default" ordering will depend on which indexes are used in the query and in what order they are used. This could change as the data/statistics change and the optimizer chooses different plans.

If you want the data in a specific order, use ORDER BY. But I'm sure you already knew that :)

Eric Petroelje
+2  A: 

Dont assume an order, if you need it in an order, use the ORDER BY clause.

CSharpAtl
Default sort order is like a box of chocolates.
TheTXI