Re: [GENERAL] continuous copy/update one table to another

2010-03-01 Thread Grzegorz Jaśkiewicz
don't use 'NOT EXISTS', as this will be damn slow. Use LEFT JOIN.

Re: [GENERAL] continuous copy/update one table to another

2010-03-01 Thread Szymon Guz
W dniu 1 marca 2010 09:40 użytkownik Grzegorz Jaśkiewicz gryz...@gmail.comnapisał: don't use 'NOT EXISTS', as this will be damn slow. Use LEFT JOIN. Right, LEFT JOIN should be faster (with proper indices even much faster).

Re: [GENERAL] continuous copy/update one table to another

2010-03-01 Thread Adrian von Bidder
Hi Terry, On Sunday 28 February 2010 22.56:41 Terry wrote: I am looking for a way to copy all the data from one table to another on a regular basis, every 5 minutes let's say. INSERT INTO table2 SELECT * FROM table1; Why do you want this? Is it necessary for the data in table2 to appear

Re: [GENERAL] continuous copy/update one table to another

2010-03-01 Thread Tom Lane
Szymon Guz mabew...@gmail.com writes: W dniu 1 marca 2010 09:40 użytkownik Grzegorz Jaśkiewicz gryz...@gmail.comnapisał: don't use 'NOT EXISTS', as this will be damn slow. Use LEFT JOIN. Right, LEFT JOIN should be faster (with proper indices even much faster). Converting NOT EXISTS into

[GENERAL] continuous copy/update one table to another

2010-02-28 Thread Terry
Hello, I am looking for a way to copy all the data from one table to another on a regular basis, every 5 minutes let's say. INSERT INTO table2 SELECT * FROM table1; The above will copy all the data as is and insert it into the other table. What happens if I rerun it again? Will it just append

Re: [GENERAL] continuous copy/update one table to another

2010-02-28 Thread John R Pierce
Terry wrote: Hello, I am looking for a way to copy all the data from one table to another on a regular basis, every 5 minutes let's say. INSERT INTO table2 SELECT * FROM table1; The above will copy all the data as is and insert it into the other table. What happens if I rerun it again? Will

Re: [GENERAL] continuous copy/update one table to another

2010-02-28 Thread David W Noon
On Sun, 28 Feb 2010 15:56:41 -0600, Terry wrote about [GENERAL] continuous copy/update one table to another: Hello, I am looking for a way to copy all the data from one table to another on a regular basis, every 5 minutes let's say. INSERT INTO table2 SELECT * FROM table1; The above will copy

Re: [GENERAL] continuous copy/update one table to another

2010-02-28 Thread Szymon Guz
2010/2/28 John R Pierce pie...@hogranch.com Terry wrote: Hello, I am looking for a way to copy all the data from one table to another on a regular basis, every 5 minutes let's say. INSERT INTO table2 SELECT * FROM table1; The above will copy all the data as is and insert it into the

Re: [GENERAL] continuous copy/update one table to another

2010-02-28 Thread John R Pierce
Szymon Guz wrote: Different doesn't mean that the id should be greater or lower, rather should be different. I'd rather do something like: indeed, my code assumed that records were only INSERT'd into table1 and never UPDATE or DELETE'd. my statement -did- have the advantage of being fast,

Re: [GENERAL] continuous copy/update one table to another

2010-02-28 Thread Terry
On Sun, Feb 28, 2010 at 6:29 PM, John R Pierce pie...@hogranch.com wrote: Szymon Guz wrote: Different doesn't mean that the id should be greater or lower, rather should be different. I'd rather do something like: indeed, my code assumed that records were only INSERT'd into table1 and never

Re: [GENERAL] continuous copy/update one table to another

2010-02-28 Thread Terry
On Sun, Feb 28, 2010 at 6:29 PM, John R Pierce pie...@hogranch.com wrote: Szymon Guz wrote: Different doesn't mean that the id should be greater or lower, rather should be different. I'd rather do something like: indeed, my code assumed that records were only INSERT'd into table1 and never

Re: [GENERAL] continuous copy/update one table to another

2010-02-28 Thread John R Pierce
Terry wrote: One more question. This is a pretty decent sized table. It is estimated to be 19,038,200 rows. That said, should I see results immediately pouring into the destination table while this is running? SQL transactions are atomic. you wont' see anything in the 'new' table

Re: [GENERAL] continuous copy/update one table to another

2010-02-28 Thread Terry
On Sun, Feb 28, 2010 at 7:12 PM, John R Pierce pie...@hogranch.com wrote: Terry wrote: One more question.  This is a pretty decent sized table.  It is estimated to be 19,038,200 rows.  That said, should I see results immediately pouring into the destination table while this is running? SQL

Re: [GENERAL] continuous copy/update one table to another

2010-02-28 Thread Terry
On Sun, Feb 28, 2010 at 10:23 PM, Terry td3...@gmail.com wrote: On Sun, Feb 28, 2010 at 7:12 PM, John R Pierce pie...@hogranch.com wrote: Terry wrote: One more question.  This is a pretty decent sized table.  It is estimated to be 19,038,200 rows.  That said, should I see results immediately