"last_user_update" information of a database table

Discussion forum about all things SqlBase.
Uwe van der Horst
Site Admin
Site Admin
Germany
Posts: 506
Joined: 05 Mar 2017, 14:21
Location: Wetter (Ruhr), Germany

"last_user_update" information of a database table

Post by Uwe van der Horst » 05 Dec 2015, 23:19

Hi,

we have implemented some timer-based queries to find out if the user has modified the table of a database. Example is a a taskbar where the user can see all of his daily tasks. Every 60 seconds this taskbar is updated/refreshed automatically. To avoid a huge SELECT of all the referenced tables which lasts some seconds (= customer is annoyed by an hourglass), we would like to have something like an "last_user_update" information of a database table which is updated automatically by the database after each update/delete/insert.

Example: SELECT last_user_update FROM tasks

If the table has been updated, we would go on with the refresh. If not, we would have no further delay/hourglass. I know that TD-7 has multithreading, but nevertheless in some cases this database feature would be helpful.

Best regards,
Best regards,
Uwe van der Horst
Advo-web GmbH

Mike Vandine

Re: "last_user_update" information of a database table

Post by Mike Vandine » 08 Dec 2015, 05:07

Hi Uwe,

That's a nice request, but I think that Development would reject it, simply because of the locking problems that could occur to update that one item in one of the system tables every time someone does an update to a table. This could be a huge overhead (and possibly cause more hourglasses).

I think you should be able to do this using a trigger, i.e. an 'after update on tasks' where you update a specific record indicating who the last updater was. Do this for critical tables and then you can select from that row to see if the user matches.

Would that be a possibility?

Best regards,

Uwe van der Horst
Site Admin
Site Admin
Germany
Posts: 506
Joined: 05 Mar 2017, 14:21
Location: Wetter (Ruhr), Germany

Re: "last_user_update" information of a database table

Post by Uwe van der Horst » 08 Dec 2015, 08:48

mvandine wrote:I think you should be able to do this using a trigger, i.e. an 'after update on tasks' where you update a specific record indicating who the last updater was. Do this for critical tables and then you can select from that row to see if the user matches.
Hi Mike, thank you for your quick answer. THIS is the way we are already doing this :D
It works perfect. The only thing is that we must delete the trigger before changing the database structure when releasing a new version (i.e. from within our setup) and create it again after the setup is finished. But it is ok for us, that was just an idea.
Best regards,
Uwe van der Horst
Advo-web GmbH

Mike Vandine

Re: "last_user_update" information of a database table

Post by Mike Vandine » 08 Dec 2015, 09:01

I suspected as much. Thanks for your understanding. :)

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests