Re: [PERFORM] Help trying to tune query that executes 40x slower than in SqlServer

2005-03-09 Thread Russell Smith
On Wed, 9 Mar 2005 11:08 pm, Hugo Ferreira wrote: > For example... I run the query, it takes 122seconds. Then I delete the > target tables, vacuum the database, re-run it again: 9s. But if I run > vacuum several times, and then run, it takes again 122seconds. If I > stop this 122seconds query, say,

Re: [PERFORM] Help trying to tune query that executes 40x slower than in SqlServer

2005-03-09 Thread Hugo Ferreira
Hi, Well, I think the problem is far more complex than just joins reordering... I've restrucutred the query so that it won't use any explicit joins.Instead it now has a series of 'in (select ...)' and 'not exists (select ...)'. This actually got faster... sometimes!!! select 1, 1168, C.contx

Re: [PERFORM] Help trying to tune query that executes 40x slower than in SqlServer

2005-03-07 Thread Tom Lane
Hugo Ferreira <[EMAIL PROTECTED]> writes: > SELECT 514, 1168, C.contxt_id, C.contxt_elmt_ix, null, null, > null, null, null, null, 1 > FROM CONTXT as P INNER JOIN CONTXT_ELMT as C on P.contxt_id = C.contxt_id >INNER JOIN MRS_REPLICATION_OUT as S on S.ent_id=1029 >

Re: [PERFORM] Help trying to tune query that executes 40x slower than in SqlServer

2005-03-07 Thread Hugo Ferreira
I'm sorry for my unpolite query alignment. Here is the query in a more human-readable format: SELECT 514, 1168, C.contxt_id, C.contxt_elmt_ix, null, null, null, null, null, null, 1 FROM CONTXT as P INNER JOIN CONTXT_ELMT as C on P.contxt_id = C.contxt_id INNER JOIN MRS_REPLICATION_OUT

Re: [PERFORM] Help trying to tune query that executes 40x slower than in SqlServer

2005-03-07 Thread Josh Berkus
Hugo, > insert into MRS_REPLICATION_OUT select 514, 1168,  C.contxt_id, > C.contxt_elmt_ix, CAST(null as NUMERIC(18)), CAST(null as > NUMERIC(18)), CAST(null as NUMERIC(18)), CAST(null as NUMERIC(18)), > CAST(null as NUMERIC(18)), null, 1 from c2iedm.CONTXT as P inner join > c2iedm.CONTXT_ELMT

[PERFORM] Help trying to tune query that executes 40x slower than in SqlServer

2005-03-07 Thread Hugo Ferreira
Hi there :-) I'm really, really having trouble with this query... It is a part of, hmmm... 200 similar querys that I dinyamically build and run in a stored procedure. This one, for example, takes 27seconds to run. The whole stored procedure executes in about 15minutes. This is too much when compar