Thread: auto insert data every one minute

auto insert data every one minute

From
searchelite
Date:
Hi all..

I have an sql script consists of insert statement data. I want to insert
every row of data every one minute. How can i do that using batch file in
windows

Thank you
--
View this message in context: http://www.nabble.com/auto-insert-data-every-one-minute-tp20027811p20027811.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: auto insert data every one minute

From
"Richard Broersma"
Date:
On Fri, Oct 17, 2008 at 12:32 AM, searchelite <searchelite@gmail.com> wrote:

> I have an sql script consists of insert statement data. I want to insert
> every row of data every one minute. How can i do that using batch file in
> windows

Take a look at your windows scheduler in the control panel.  You might
need to spend quite a bit of time configuring a 1 minute interval
since it only seems to be designed for daily occurrences.


--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

Re: auto insert data every one minute

From
Jason Long
Date:
Richard Broersma wrote:
On Fri, Oct 17, 2008 at 12:32 AM, searchelite <searchelite@gmail.com> wrote:
 
I have an sql script consists of insert statement data. I want to insert
every row of data every one minute. How can i do that using batch file in
windows   
Take a look at your windows scheduler in the control panel.  You might
need to spend quite a bit of time configuring a 1 minute interval
since it only seems to be designed for daily occurrences.

 
Use Linux and you life will become much easier. ;)

Re: auto insert data every one minute

From
"Daniel Verite"
Date:
    searchelite wrote:

> I have an sql script consists of insert statement data. I want to
insert
> every row of data every one minute. How can i do that using batch
file in
> windows

How about using pg_sleep ?

INSERT .... ;
COMMIT;
SELECT pg_sleep(60);

INSERT...;
COMMIT;
SELECT pg_sleep(60);

...

 Best regards,
--
 Daniel
 PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org

Re: auto insert data every one minute

From
"Grzegorz Jaśkiewicz"
Date:
how about windows task scheduler ? (cron-ish thing) 

--
GJ

Re: auto insert data every one minute

From
"Daniel Verite"
Date:
    Grzegorz Jaśkiewicz wrote:

> how about windows task scheduler ? (cron-ish thing)

If the OP wants to do the exact same insert every minute, then the OS
scheduler sure does the job.

That's not how I understood the question, though. My interpretation is
that he has a SQL script with an ordered list of INSERTs to perform and
he wants to throttle the execution, in which case scheduling at the OS
level doesn't help that much.

 Best regards,
--
 Daniel
 PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org

Re: auto insert data every one minute

From
searchelite
Date:


Daniel Verite wrote:
>
>     searchelite wrote:
>
>
> How about using pg_sleep ?
>
> INSERT .... ;
> COMMIT;
> SELECT pg_sleep(60);
>
> INSERT...;
> COMMIT;
> SELECT pg_sleep(60);
>
>
>
>


i can use pg_sleep..but i have thousands of data to be inserted..is there
any better way using pg_sleep?

--
View this message in context: http://www.nabble.com/auto-insert-data-every-one-minute-tp20027811p21263763.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: auto insert data every one minute

From
Reg Me Please
Date:
You need to write a process that will do it.
At best you can use crontab if your a lucky and use Unix.



--
Fahrbahn ist ein graues Band
weisse Streifen, grüner Rand

On Saturday January 3 2009 11:46:47 searchelite wrote:
> Daniel Verite wrote:
> >     searchelite wrote:
> >
> >
> > How about using pg_sleep ?
> >
> > INSERT .... ;
> > COMMIT;
> > SELECT pg_sleep(60);
> >
> > INSERT...;
> > COMMIT;
> > SELECT pg_sleep(60);
>
> i can use pg_sleep..but i have thousands of data to be inserted..is there
> any better way using pg_sleep?
>
> --
> View this message in context:
> http://www.nabble.com/auto-insert-data-every-one-minute-tp20027811p21263763
>.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.



Re: auto insert data every one minute

From
Tino Wildenhain
Date:
Hi,

searchelite wrote:
...

> i can use pg_sleep..but i have thousands of data to be inserted..is there
> any better way using pg_sleep?

I wonder what is you complete problem? It seems all the advices given
so far are shots-in-the-dark. Could you perhaps expand a bit?

Also for sophisticated solution, if you stick to windows you might
want to consider something different then just pure CMD, say some
scripting language to support.

Tino



Attachment

Re: auto insert data every one minute

From
Christophe Chauvet
Date:
Hi

Why don't use pgAgent http://pgadmin.org/docs/dev/pgagent.html ?

Regards,

Christophe Chauvet.

Tino Wildenhain a écrit :
> Hi,
>
> searchelite wrote:
> ...
>
>> i can use pg_sleep..but i have thousands of data to be inserted..is
>> there
>> any better way using pg_sleep?
>
> I wonder what is you complete problem? It seems all the advices given
> so far are shots-in-the-dark. Could you perhaps expand a bit?
>
> Also for sophisticated solution, if you stick to windows you might
> want to consider something different then just pure CMD, say some
> scripting language to support.
>
> Tino
>
>


Re: auto insert data every one minute

From
searchelite
Date:


Tino Wildenhain wrote:
>
>
> I wonder what is you complete problem? It seems all the advices given
> so far are shots-in-the-dark. Could you perhaps expand a bit?
>
> Also for sophisticated solution, if you stick to windows you might
> want to consider something different then just pure CMD, say some
> scripting language to support.
>
> Tino
>
>

I have pre-recorded gps data in .sql insert format..for simulate real-time
tracking, i want to insert the data in let say every one minute

--
View this message in context: http://www.nabble.com/auto-insert-data-every-one-minute-tp20027811p21524797.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: auto insert data every one minute

From
"Joshua D. Drake"
Date:
On Sat, 2009-01-17 at 22:40 -0800, searchelite wrote:
>
>
> Tino Wildenhain wrote:
> >
> >
> > I wonder what is you complete problem? It seems all the advices given
> > so far are shots-in-the-dark. Could you perhaps expand a bit?
> >
> > Also for sophisticated solution, if you stick to windows you might
> > want to consider something different then just pure CMD, say some
> > scripting language to support.
> >
> > Tino
> >
> >
>
> I have pre-recorded gps data in .sql insert format..for simulate real-time
> tracking, i want to insert the data in let say every one minute

Feed the data to a loop that waits every 60 seconds. You could also pipe
it to a named pipe while an injector was listening.

Joshua D. Drake

>
> --
> View this message in context: http://www.nabble.com/auto-insert-data-every-one-minute-tp20027811p21524797.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>
--
PostgreSQL - XMPP: jdrake@jabber.postgresql.org
   Consulting, Development, Support, Training
   503-667-4564 - http://www.commandprompt.com/
   The PostgreSQL Company, serving since 1997