Greetings!

If you do not have an index on any column in a table, how does mysql
handle repeated queries (i.e. SELECT * FROM report;)

I am noticing that if I run the following three queries, I get different
results for the third query:

SELECT * FROM report;
SELECT * FROM report ORDER BY lastname;
SELECT * FROM report;

Details: report has no primary key, no other keys.  report records are
inserted as the report is created, with names non-sorted (due to the
data generating the report).  The first SELECT retreives the records in
pretty much the same order as entered.  The second SELECT sorts the
records, and the third SELECT sometimes gives the same result as the
unsorted SELECT, sometimes sorted (like the second SELECT) and sometimes
just more random than ever (neither "order entered" nor "sorted").

Could one of the developers comment on how MySQL handles such a query?

p.s. This is for my understanding.  I solved my actual problem by simply
placing a primary key on the appropriate columns - as I should have from
the beginning! <G>).

Thanks,

-RIchard


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to