When was an Attribute set?

Permalink
Is there any way of, given an attribute for an object, determining when the attribute was set or last changed?

JohntheFish
 
beebs93 replied on at Permalink Reply
beebs93
The "AttributeValues" table in the database has a "avDateAdded" column that may help.

Without trying I'd guess you'd simply have to do a couple of SELECT queries to get the date the value was added and last updated.

Without knowing what you're going to use the info for I'm not sure what to suggest next.
JohntheFish replied on at Permalink Reply
JohntheFish
I am looking at periodically updating some page attributes from the view of a block on each page, but don't want to thrash the updates, so was working towards limiting updates by time intervals.

I suspect your tip to get in there with the SQL may be the only way to go, but was hoping there would be a better way somewhere already in the attributes interface; perhaps not that well known.
jordanlev replied on at Permalink Reply
jordanlev
What do you mean by "thrash the updates"?
JohntheFish replied on at Permalink Reply
JohntheFish
The ideas I am playing with would involve updating one or more attributes of a page when a page is viewed. I could just do it every time the page is viewed, but that would involve making database updates each time that page is viewed. If the page is viewed a lot, and other pages do similar, that could amount to a fair amount of database updates.

Updates are generally considerably slower than reads and most of the time the new attribute values I am setting will be exactly the same as the old values. I could adopt a test-and-update-if-changed strategy, but that still involves a lot of reads and the processing to see if there would be a change, when there are very few changes.

So my idea was to add a throttle, along the lines of "if it has been less than XX mins since the attribute was last updated, then don't even bother to test or update". If the last updated time of an attribute is readily available then it could come out of the database at no extra cost to reading the attribute. (If I had to add my own table to track this, then any advantage would of course be negated.)

All of this will probably be in an AJAX transaction from the page, so throttling has a second advantage of removing a lot of network traffic.
jordanlev replied on at Permalink Reply
jordanlev
Understood -- yeah, I agree that you want to limit that somehow :)