Re: good style?

From: "Tambet Matiisen" <tambet(dot)matiisen(at)mail(dot)ee>
To: "Tambet Matiisen" <t(dot)matiisen(at)aprote(dot)ee>, <pgsql-sql(at)postgresql(dot)org>, "Rafal Kedziorski" <rafcio(at)polonium(dot)de>
Subject: Re: good style?
Date: 2003-02-25 06:42:09
Message-ID: 002601c2dc99$056ef520$0100a8c0@kodunet.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


----- Original Message -----
From: "Rafal Kedziorski" <rafcio(at)polonium(dot)de>
To: "Tambet Matiisen" <t(dot)matiisen(at)aprote(dot)ee>; <pgsql-sql(at)postgresql(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message mixo 2003-02-25 06:55:05 two dates
Previous Message Rudi Starcevic 2003-02-25 05:48:41 Sub Select inside Check ?