I have a table with 2 fields which I, every fifteen minutes, load new data
into. The data is not formatted by me. It comes from an external source, so
when the data is added to the table, the ID doesn´t come in the right order.

The table looks like this:

+-----+--------------+
| ID  | headline     |
+-----+--------------+
| 1   | head1        |
+-----+--------------+
| 2   | head2        |
+-----+--------------+
| 3   | head3        |
+-----+--------------+
| 5   | head5        |
+-----+--------------+
| 4   | head4        |
+-----+--------------+
| 6   | head6        |
+-----+--------------+

The table contains more than 600 000 rows, so querys take a VERY long time
to execute.
This simple query takes more than one and a half minutes (the server isn´t
very fast though, but still):
SELECT id,headline FROM table ORDER BY id DESC LIMIT 20;

Is there some way I can rearrange the table, so the id-numbers come in the
correct order, or speed up the query by adding some sort of an index?
If index is the solution, can someone please explain how to build an index
on this table, because I haven´t really got a hang of it yet.

Thanks,
// Tobbe



---------------------------------------------------------------------
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