List:Internals« Previous MessageNext Message »
From:Tobias Asplund Date:July 30 2007 3:43am
Subject:Re: multiple current_timestamp
View as plain text  
On Sun, 29 Jul 2007, Jim Winstead wrote:

> I don't know if there is a strong technical reason for only allowing
> a single timestamp field to be automatically set or automatically updated,
   > or the limitation was just a carry-over from when only the first timestamp
   > field was auto-set/update. I wouldn't expect anyone at MySQL to jump at
   > implementing this, but a patch would be looked at. (But since you can get
                                                         > the same effect with
                                                       > a trigger, it may not
                                                       > have a shot.)

The effect can be the same, but the performance is far from there in a trigger
We tested this for one of the User Conference sessions this year and found
that timestamp is quite efficient.

We tested:
1. Letting the timestamp take the value automatically
2. Having a BEFORE INSERT trigger set the column value into a DATETIME column
3. Forcing the function NOW() into a DATETIME column

We found that if you use NEW. or OLD. in a trigger a second pass of 
"Opening tables" is executed, the high concurrency to the table_cache
slowed it down a bit in this case (at least, that's what we could 
see from limited testing under time strain).

Tobias "flupps" Asplund <tobias@stripped>
Trainer and Consultant, Sweden
multiple current_timestampArnold Daniels29 Jul
  • Re: multiple current_timestampEric Bergen29 Jul
    • Re: multiple current_timestampArnold Daniels30 Jul
      • Re: multiple current_timestampEric Bergen30 Jul
        • Re: multiple current_timestampJim Winstead30 Jul
          • Re: multiple current_timestampTobias Asplund30 Jul
  • Re: multiple current_timestampDmitri Lenev30 Jul
  • mmaping and index file(.MYI) in mysql 5.1.22-rc?ajay singh20 Dec