473,396 Members | 1,785 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,396 software developers and data experts.

delayed input

I need to select all tuples from a table, but need them to be fetched with a
constant delay (say 1 sec) between every consecutive tuples.

The first idea that came up to my mind is to create a DelayedSeqScan
operator, and put delay before returning the scanned tuple.

Can I do this functionality using table functions?

Regards,
--h
Nov 23 '05 #1
7 1606
Why not do this on the client side? I'm just curious as to the benfit
of doing this on the server.

On Tue, 19 Oct 2004 11:10:58 -0500, Hicham G. Elmongui
<el******@cs.purdue.edu> wrote:
I need to select all tuples from a table, but need them to be fetched with a
constant delay (say 1 sec) between every consecutive tuples.

The first idea that came up to my mind is to create a DelayedSeqScan
operator, and put delay before returning the scanned tuple.

Can I do this functionality using table functions?

Regards,
--h


---------------------------(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 23 '05 #2
Hicham G. Elmongui wrote:
I need to select all tuples from a table, but need them to be fetched with a
constant delay (say 1 sec) between every consecutive tuples.

The first idea that came up to my mind is to create a DelayedSeqScan
operator, and put delay before returning the scanned tuple.

Can I do this functionality using table functions?


Could you not just use a cursor and fetch each row in turn based on some
timer in your application?

--
Richard Huxton
Archonet Ltd

---------------------------(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 23 '05 #3


Use a cursor...
I need to select all tuples from a table, but need them to be fetched
with a
constant delay (say 1 sec) between every consecutive tuples.

The first idea that came up to my mind is to create a DelayedSeqScan
operator, and put delay before returning the scanned tuple.

Can I do this functionality using table functions?

Regards,
--h

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


---------------------------(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 23 '05 #4
I need this for a side project. Is there a way to do something like this:

SELECT *
FROM DelayedTable('tablename', 5);

DelayedTable provides me with one tuple every 5 seconds.
Regards,
--h

"Hicham G. Elmongui" <el******@cs.purdue.edu> wrote in message
news:cl***********@news.hub.org...
I need to select all tuples from a table, but need them to be fetched with a constant delay (say 1 sec) between every consecutive tuples.

The first idea that came up to my mind is to create a DelayedSeqScan
operator, and put delay before returning the scanned tuple.

Can I do this functionality using table functions?

Regards,
--h

Nov 23 '05 #5
Hicham G. Elmongui wrote:
I need this for a side project. Is there a way to do something like this:

SELECT *
FROM DelayedTable('tablename', 5);


No, at my knowledge you'll obtain the first tuple only when
the function exit.
Regards
Gaetano Mendola

Nov 23 '05 #6
On Tue, Oct 19, 2004 at 01:44:34PM -0500, Hicham G. Elmongui wrote:
I need this for a side project. Is there a way to do something like this:

SELECT *
FROM DelayedTable('tablename', 5);


You can probably build a sleep() function in C, and then use that to
cause delaying in a PL/pgSQL set-returning function. Something like

#include <postgres.h>
#include <fmgr.h>

PG_FUNCTION_INFO_V1(sleep);

Datum
sleep(PG_FUNCTION_ARGS)
{
int32 delay = PG_GETARG_INT32(0);
sleep(delay);
PG_RETURN_VOID();
}

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
La web junta la gente porque no importa que clase de mutante sexual seas,
tienes millones de posibles parejas. Pon "buscar gente que tengan sexo con
ciervos incendiándose", y el computador dirá "especifique el tipo de ciervo"
(Jason Alexander)
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #7
Well, it seems that i have to build the scan operator myself. Even the
FunctionScan will make all the function calls and stores the result in a
tuuplestore. So, all the delay will be occured only at the first function
invocation.
--h


"Alvaro Herrera" <al******@dcc.uchile.cl> wrote in message
news:20*******************@dcc.uchile.cl...
On Tue, Oct 19, 2004 at 01:44:34PM -0500, Hicham G. Elmongui wrote:
I need this for a side project. Is there a way to do something like this:
SELECT *
FROM DelayedTable('tablename', 5);
You can probably build a sleep() function in C, and then use that to
cause delaying in a PL/pgSQL set-returning function. Something like

#include <postgres.h>
#include <fmgr.h>

PG_FUNCTION_INFO_V1(sleep);

Datum
sleep(PG_FUNCTION_ARGS)
{
int32 delay = PG_GETARG_INT32(0);
sleep(delay);
PG_RETURN_VOID();
}

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
La web junta la gente porque no importa que clase de mutante sexual seas,
tienes millones de posibles parejas. Pon "buscar gente que tengan sexo con
ciervos incendiándose", y el computador dirá "especifique el tipo de

ciervo" (Jason Alexander)
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #8

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

Similar topics

7
by: Leo Breebaart | last post by:
Hi all, I have a question about Python and delayed evaluation. Short-circuiting of Boolean expressions implies that in: >>> if a() and b(): any possible side-effects the call to b() might...
13
by: Brian | last post by:
Hi all... This question is more for the GURUs out there. It is not a question on how to do something, but why it happens, and I am trying to figure out if there is a pattern. I am using IE, but...
0
by: subi | last post by:
Hi, I don't know where's the best place to post my question. I hope it suits this group. I have created an assembly with a delay sign attribute set to true in the AssemblyInfo.cs. And the key...
3
by: Nospam | last post by:
I'm trouble shooting my obfuscated program. I'd like suggestions on some tools to help. I'm using vs2005 with delayed signing option from the project settings and reading the hash from a key.snk...
5
by: Thomas Urban | last post by:
Hi, I'm probably asking something posted several times before and maybe you feel annoyed by answering ... please excuse me nevertheless, as I need an urgent statement on whether and why this...
5
by: Jim in Arizona | last post by:
I realize that by design, web client/server interaction is disconnected. I'm wondering if there is a way that when a client/server interaction occurs, if there is a way to start a time on the web...
1
by: Jan Doggen | last post by:
Hello all, I have a SELECT like this (the 'alert()s are temporary): <FORM method="POST" action="/scripts/runisa.dll?OVB2.132964:PGSPLITVACAFMELDEN:1095144287.9159" id="hulpform"...
2
by: Amey Agnihotri | last post by:
Hi! I'm trying to run a few AT commands on a GSM modem. I'm doing this in C#.Net 2005. When I run a few commands one after the other, the response generation takes a long time. The response for...
8
by: Grorange | last post by:
Writing ASP.NET pages, I have a need for client-side functions to prevent going to the server for every small change. I have a list of server side created checkboxes filled with a lot of...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.