Re: Inserting a timed delay in a pl/pgsql procedure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Aug 18, 2006, at 3:26 PM, Benjamin Krajmalnik wrote:

However, it appears that current_timestamp is not being recalculated.
Any ideas? While normally we want the stored procedures to run as
quickly as possible, this is a case where I need to insert a delay.
I guess an option would be to place a counter and loop through it, but
it does not allow me the control I relly need.

current_timestamp returns the same value for the scope of the transaction (or function call). Search the archives for "sleep" for previous discussions of this issue. You can use timeofday to get a changing time value, but any looping you do in plpgsql will eat a lot of CPU cycles. The only other solution I recall was to use a different pl language like perl which has a proper sleep function.


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux