From: Josh Berkus <josh@agliodbs.com>
To: Hugo Ferreira <bytter@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Help trying to tune query that executes 40x slower than in SqlServer
Date: Mon, 7 Mar 2005 09:28:47 -0800
Message-ID: <200503070928.47118.josh@agliodbs.com> (raw)
In-Reply-To: <4e8efcf50503070901406808be@mail.gmail.com>
References: <20050304002724.650A95AF649@svr4.postgresql.org>
<4e8efcf50503040413245d80f9@mail.gmail.com>
<4e8efcf50503070901406808be@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: josh@agliodbs.com, bytter@gmail.com
Subject: Re: Help trying to tune query that executes 40x slower than in SqlServer
In-Reply-To: <200503070928.47118.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox