473,387 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

last update time of a table

pg
Is there any simple way to query the most recent time of "changes" made to a
table?

I'm accessing my database with ODBC to a remote site thru internet. I want
to eliminate some DUPLICATE long queries by evaluating whether the data has
been
changed since last query. What should I do?

-Jason
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #1
6 8534
On Friday 05 December 2003 01:21, pg wrote:
Is there any simple way to query the most recent time of "changes" made to
a table?

I'm accessing my database with ODBC to a remote site thru internet. I want
to eliminate some DUPLICATE long queries by evaluating whether the data has
been
changed since last query. What should I do?


The canonical way is to add a last_changed column and a trigger to make sure
it gets updated whenever the rest of the row is.

Go over to http://techdocs.postgresql.org/ and check in the plpgsql cookbook
or my Postgresql notes, or the archives come to think of it.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #2
pg
I read thru your info, thanks a lot.

In fact, I only need to decide whether a table (the whole) has been updated
since last query. I have some pulldown menus in a VB app which extract data
from a remote site with slow connection. And the data in those tables for
pulldowns changes rarely. So if the pulldown has to extract the data and
transmit it thru slow connection, the pulldown will take a few seconds to be
in action, which is a little bit annoying, especially if the data is the
same as in the array of client. So if I can query the table, knowing that no
data changed in the table since my last query, I can use the client side
array as pulldown data without waiting for long transmition time.

I wonder if there is some more direct method, or thru the pg system tables
to get this info. If there's not out there, I would use a trigger which will
update a seperate table containing the last update time of all tables (not
records) for pulldowns.

-Jason

----- Original Message -----
From: "Richard Huxton" <de*@archonet.com>
To: "pg" <pg@newhonest.com>; <pg***********@postgresql.org>
Sent: Friday, December 05, 2003 5:53 PM
Subject: Re: [GENERAL] last update time of a table

On Friday 05 December 2003 01:21, pg wrote:
Is there any simple way to query the most recent time of "changes" made to a table?

I'm accessing my database with ODBC to a remote site thru internet. I want to eliminate some DUPLICATE long queries by evaluating whether the data has been
changed since last query. What should I do?
The canonical way is to add a last_changed column and a trigger to make

sure it gets updated whenever the rest of the row is.

Go over to http://techdocs.postgresql.org/ and check in the plpgsql cookbook or my Postgresql notes, or the archives come to think of it.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #3
pg wrote:
In fact, I only need to decide whether a table (the whole) has been updated
since last query. I have some pulldown menus in a VB app which extract data
from a remote site with slow connection. And the data in those tables for
pulldowns changes rarely. So if the pulldown has to extract the data and
transmit it thru slow connection, the pulldown will take a few seconds to be
in action, which is a little bit annoying, especially if the data is the
same as in the array of client. So if I can query the table, knowing that no
data changed in the table since my last query, I can use the client side
array as pulldown data without waiting for long transmition time.

I wonder if there is some more direct method, or thru the pg system tables
to get this info. If there's not out there, I would use a trigger which will
update a seperate table containing the last update time of all tables (not
records) for pulldowns.
You can use LISTEN/NOTIFY to do what you want:

http://www.postgresql.org/docs/curre...ql-listen.html
-Jason


Mike Mascari
ma*****@mascari.com

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #4
> In fact, I only need to decide whether a table (the whole) has been updated
since last query. I have some pulldown menus in a VB app which extract data
from a remote site with slow connection. And the data in those tables for
pulldowns changes rarely. So if the pulldown has to extract the data and
transmit it thru slow connection, the pulldown will take a few seconds to be
in action, which is a little bit annoying, especially if the data is the
same as in the array of client. So if I can query the table, knowing that no
data changed in the table since my last query, I can use the client side
array as pulldown data without waiting for long transmition time.

I wonder if there is some more direct method, or thru the pg system tables
to get this info. If there's not out there, I would use a trigger which will
update a seperate table containing the last update time of all tables (not
records) for pulldowns.


You can use NOTIFY/LISTEN with triggers on
update/delete/insert.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #5
pg wrote:
I have some pulldown menus in a VB app which extract data
from a remote site with slow connection. And the data in those tables for
pulldowns changes rarely. So if the pulldown has to extract the data and
transmit it thru slow connection, the pulldown will take a few seconds to be in action, which is a little bit annoying, especially if the data is the
same as in the array of client.


Probably you'll do it better storing a local cached copy of the pulldown
data (in the VB side) and having a background process to refresh it only
when the server notifies that it has changed.

hth
cl.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #6
pg
Thanks for your suggestion. I think this is exactly Karsten and Mike said :

create triggers to notify the client for any kind of updates.

I'm not sure whether VB can handle such events, so I have to further study
on this.

-Jason

----- Original Message -----
From: "Claudio Lapidus" <cl******@hotmail.com>
To: "pg" <pg@newhonest.com>; <pg***********@postgresql.org>
Sent: Sunday, December 07, 2003 11:09 PM
Subject: Re: [GENERAL] last update time of a table

pg wrote:
I have some pulldown menus in a VB app which extract data
from a remote site with slow connection. And the data in those tables for pulldowns changes rarely. So if the pulldown has to extract the data and
transmit it thru slow connection, the pulldown will take a few seconds
to be
in action, which is a little bit annoying, especially if the data is the
same as in the array of client.


Probably you'll do it better storing a local cached copy of the pulldown
data (in the VB side) and having a background process to refresh it only
when the server notifies that it has changed.

hth
cl.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: gsb | last post by:
I'm not very good in mySQL but am trying to modify a script. It has to do with a log table. I want to retrieve the last 2 log records (if any) and if the last log entries are the same as my...
8
by: Shawn McKenzie | last post by:
Can someone help me with a query to get the date/time that a database was last modified? I looked at the SHOW command but there was no mention of this. TIA, Shawn
4
by: Ike | last post by:
Is there a way in mysql to discern when the last date/time a field, row, or table was been updated or inserted? Thanks, ike
12
by: francisds | last post by:
Hi, Can you guys see if there's a solution to this problem? I have a database from which I have to read each record and process that record. New records are being added all the time, so I...
3
by: Ray | last post by:
I am having my first experience using BLOB as a row in a table. I am using it to insert graphics for labels we print. I have no problem inserting into and select from the table. The graphic is...
2
by: Mark Reed | last post by:
Hi all, Scenario: I have about 10 people using a front end database which only 2 have the privilege to update the information. This is done by pasting the contents of a notepad report into a...
0
by: Bob | last post by:
Background 1. I create a data table that has one primary key and one unique column with other columns as well 2. I then Bind it to my list countrol setting the DataSource to my table name and...
7
by: Hieronimus | last post by:
Hi all I inherited a server running MySQL 4.* from a previous developer. Now, the records on this database might be what I want, or they might just be test data. I think my only chance of...
0
by: marlberg | last post by:
Platform: Windows2000, WindowsXP, Windows Vista, etc Language: C#, ASP.NET Pre-compiled Libraries: Enterprise Library 3.0 full I have a requirement to implement in and display in C# and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.