Re: Help trying to tune query that executes 40x slower than in SqlServer - Mailing list pgsql-performance

From Josh Berkus
Subject Re: Help trying to tune query that executes 40x slower than in SqlServer
Date
Msg-id 200503070928.47118.josh@agliodbs.com
Whole thread Raw
In response to Help trying to tune query that executes 40x slower than in SqlServer  (Hugo Ferreira <bytter@gmail.com>)
Responses Re: Help trying to tune query that executes 40x slower than in SqlServer
List pgsql-performance
Hugo,

> insert into MRS_REPLICATION_OUT select 514, 10000168,  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 as C on (P.contxt_id=C.contxt_id) inner join
> MRS_REPLICATION_OUT as S on S.ent_id=10000029 and (CAST(P.contxt_id AS
> numeric(18)) = S.pk1) inner join MRS_TRANSACTION TRANS on

Can you *format* this query please, and re-submit it?   Proper query format
looks like:

SELECT a.1, b.2
FROM a JOIN b ON a.1 = b.3
    JOIN c ON b.4 = c.1
WHERE a.5 < 6
     AND c.7 = '2005-01-01';

... for maximum readability.

Also, when asking others to help debug your queries, it helps them (and,
frankly, you) if you can NOT use single-letter table aliases.   Single-letter
table aliases are evil for the same reason that single-letter variables in
code are.

Thanks!

--
Josh Berkus
Aglio Database Solutions
San Francisco

pgsql-performance by date:

Previous
From: John A Meinel
Date:
Subject: Re: [pgsql-hackers-win32] Help with tuning this query (with
Next
From: Josh Berkus
Date:
Subject: Re: Tuning, configuration for 7.3.5 on a Sun E4500