[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    [GENERAL] Is there a way to query whether a table has been changed or not?
From:       "Xueying (Libby) SHEN" <xshen () cs ! umass ! edu>
Date:       2002-09-06 22:12:19
[Download RAW message or body]

Hi,
I am doing a project to switch from a home-grown plain-text based database
to PostgreSQL. Before, we can always check the timestamp of the file to tell
whether the local info cached is staler than the file or not. So I am
wondering if there is something similar in PostgreSQL?.
Basically, the scenario is that two transactions are working in parallel.
Both of them do some SELECT queries and build their local list and work on
that list. Then both of them decide to add a new entry to the db. Due to
some legacy design problem, I cannot take advantage of the PostgreSQL
features and have to let the two transactions lock the whole table before
they add the entries. When one transation holds the lock, the other one
will be blocked waiting. But when the first transaction is done and
releases the lock, is there any way to let the second transaction check to
see if there is any change in the db table, and if not, go ahead,
otherwise it needs to do SELECT queries and refreshes its local cached
information and starts the process again to add a new entry? (Here the new
entries have some dependencies on each other, and there is no luxury in
the system to do rollback. :(( )
Thanks a lot!

--
Libby


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic