----- Original Message -----
From: "Rafal Kedziorski" <rafcio@polonium.de>
To: "Tambet Matiisen" <t.matiisen@aprote.ee>; <pgsql-sql@postgresql.org>
Sent: Monday, February 24, 2003 1:51 AM
Subject: Re: [SQL] good style?
> [snip]
>
>
> original:
>
> Merge Join (cost=728.47..820.47 rows=1000 width=366)
> ...
>
>
> 1st join:
> Merge Join (cost=3042.29..3184.29 rows=5000 width=366)
> ...
>
>
> 2nd join:
> Merge Join (cost=3042.29..3184.29 rows=5000 width=366)
> ...
>
>
> have I post thic correctly using JOIN?
>
>
Optimizer expects the original query to return 1000 rows, while others are
expected to return 5000 rows. I compared the original query with others, but
didn't see any difference at first sight. I don't know, if the expected row
count depends on execution path in Postgres. You can look at explain output
of original query and imitate the join order chosen by optimizer by JOINs,
and then compare costs.
What are the real-world timings? And do these queries actually return the
same result? If you calculate cost for fetching one row, then 3184,29 / 5000
= 0,636858, while 820.47 / 1000 = 0,82047. So maybe it's not that bad at
all.
Tambet