I need to create an InnoDB
table that I will use to add data to and constantly fetch the most recent 10 rows added to it. To avoid having to do an ORDER BY
with every SELECT
query to get those last 10 rows, I would like to have the table itself ordered by the Primary Key
in DESC
order so that I can skip the ORDER BY
entirely and just do a SELECT ... LIMIT 10
, which should automatically pull the most recent 10 rows added to the table.
How can I do that? Is it as simple as adding ORDER BY [PRIMARYKEY] DESC
to the CREATE TABLE
query? Will the table continue to be sorted in DESC
order even after INSERT
ing new rows?