Optimising LIMITs - alter table order by...
| From: | Richard Davey | Date: | Tue, 02 Mar 2004 11:17:29 +0000 |
| Subject: | Optimising LIMITs - alter table order by... | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33251@lists.php.net to get a copy of this message | ||
Hello Pavel,
Tuesday, March 2, 2004, 7:20:03 AM, you wrote:
PL> 2. ALTER TABLE
board ORDER BY
PL> threadid DESC;
I never knew you could do this - it's quite fascinating this list
sometimes :)
I do have a question though - if I use this "order by" table
alteration, does MySQL remember it, or will I need to keep doing it
every now and again?
For example if I view the data in my table I can see the IDs like
this:
1
2
3
250
5
6
323
(etc)
This is simply where MySQL has gone back and re-used an old slot for a
new record.
However if I use your query technique for bringing back a block of
records knowing they're in the exact right sequence - will MySQL just
fragment this again over time?
PL> Split your table in two tables, like:
I can't see a real benefit of doing this. In my mind 675 bytes per
thread isn't really that much. The only thing I could split away would
be the subject of the thread (associated messages are held elsewhere)
but in making a smaller table I'd just have to join the data back in
again, surely?
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html