Re: [SQL] update from select

2007-10-29 Thread Tom Lane
<[EMAIL PROTECTED]> writes: > Hash Join (cost=10827.45..25950.05 rows=4906 width=1191) (actual > time=586.251..2852.691 rows=111306 loops=1) > ... > Total runtime: 633548.404 ms So you're worried about the wrong thing entirely. The query is taking less than 3 seconds, which may be reasonable con

Re: [SQL] update from select

2007-10-29 Thread Pavel Stehule
ail_dvd.release_date. Maybe there is other problem. The casting from (probably) date to text in releasedate column. Is it correct? what is original type for releasedate column? Pavel > > Thaks for helping!! Bye the way, we are changing our system from MSSQL2000 > to Postgres :-)! >

Re: [SQL] update from select

2007-10-29 Thread dev
tal runtime: 1039998.325 ms *** Thaks for helping!! Bye the way, we are changing our system from MSSQL2000 to Postgres :-)! Regards Reto -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von A. Kr

Re: [SQL] update from select

2007-10-29 Thread Tom Lane
<[EMAIL PROTECTED]> writes: > Is there a better way to do this update: > UPDATE table1 SET column2 = temp_table.column2, column3 = > temp_table.column3, column4 = CAST(temp_table.column4 AS date) FROM > ( > SELECT DISTINCT > table2.column1, > table2.column2, > table2.column3, > table2.column4

Re: [SQL] update from select

2007-10-29 Thread Pavel Stehule
Hello you use corelated subquery and that is slow for thausands rows. Use PostgreSQL's extension UPDATE table1 SET column2 = t,colum2, FROM table2 t WHERE table1.column1 = t.column1 and t.column4 is not null and ... http://www.postgresql.org/docs/8.2/interactive/sql-update.html Regards Pav

Re: [SQL] update from select

2007-10-29 Thread A. Kretschmer
am Mon, dem 29.10.2007, um 10:18:38 +0100 mailte [EMAIL PROTECTED] folgendes: > > WHERE table1.column1 = temp_table.column1; table1.column1 and temp_table.column1 have the same type? > > > > The select by it?s own takes around 1 second. The Update is around 120?000 > rows. I got an index on

Re: [SQL] update from select

2003-10-29 Thread Gary Stainburn
On Wednesday 29 Oct 2003 2:58 pm, Stephan Szabo wrote: > On Wed, 29 Oct 2003, Gary Stainburn wrote: > > Hi folks, > > > > don't know if it's cos of the 17 hours I've just worked (sympathy vote > > please) but I can't get this one worked out > > > > I've got table names with nid as name id field and

Re: [SQL] update from select

2003-10-29 Thread Stephan Szabo
On Wed, 29 Oct 2003, Gary Stainburn wrote: > Hi folks, > > don't know if it's cos of the 17 hours I've just worked (sympathy vote please) > but I can't get this one worked out > > I've got table names with nid as name id field and nallowfollow flag. > I've got a vehicles table with vowner pointing