Jump to content


Photo

Inserting before the first entry


  • Please log in to reply
3 replies to this topic

#1 minavio

minavio
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 19 March 2003 - 04:33 PM

How do you issue an insert statement that will insert the entry to the beginning of the table, before all the other entries, each time?

Any help would be greatly appreciated, thanks.

#2 ystrigathe

ystrigathe
  • Members
  • Pip
  • Newbie
  • 5 posts
  • LocationCologne / Germany

Posted 19 March 2003 - 04:54 PM

physically into the files? no way...

#3 minavio

minavio
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 19 March 2003 - 07:19 PM

What I mean is, when I run a

mysql_query (\"INSERT INTO ...

command, it will sometimes append the new entry at the end of the table, sometimes at the beginning, sometimes in the middle... I don\'t know how to tell it to always insert the entry at the beginning of the table.

#4 ystrigathe

ystrigathe
  • Members
  • Pip
  • Newbie
  • 5 posts
  • LocationCologne / Germany

Posted 20 March 2003 - 07:55 AM

if u deleted some records, the data file will contain a \'hole\'. If u insert a new record mysql will re-use these \'holes\'. So you have no chance to get control over this behaviour \'til you take the source and build the engine new.

But how do you check for the order? A select-statement doesn\'t say anything about the physically order in the files; it\'s just in which order mysql proceeds the records...

By the way: in most databases there\'s a possibility to defrag & re-organize your tables. But in this case, the new records will find a place at the end of the data file...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users