Re: [HACKERS] nested loops in joins, ambiguous rewrite rules

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: charlie(at)k4azl(dot)net (Charles Hornberger)
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] nested loops in joins, ambiguous rewrite rules
Date: 1999-01-31 03:12:50
Message-ID: 199901310312.WAA06973@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

See the SET options of psql.

test=> show geqo\g
NOTICE: GEQO is ON beginning with 8 relations
SHOW VARIABLE
test=> \q

We turn on geqo at 8 relations. Try:

SET GEQO TO 4

and try the query again. Let us know.

> At 04:07 PM 1/30/99 -0500, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >First, you're assuming that a merge-join plan is necessarily better than
> >a nested-loop plan. That should be true for large queries, but it is
> >*not* necessarily true for small tables --- when there are only a few
> >tuples in the tables being scanned, a simple nested loop wins because it
> >has much less startup overhead. (Or at least that's what our optimizer
> >thinks; I have not tried to measure this for myself.)
>
> OK, I understand that I don't understand whether merge-join plans are
> necessarily better than nested-loop plans, and that it could make sense to
> pick one or the other depending on the size of the tables and the number of
> rows in them. Also, your explanation of how 'vacuum analyze' updates the
> statistics in pg_class and pg_statistic makes it very clear why I'm seeing
> one query plan in one DB, and different plan in the other. Thanks for the
> quick lesson, and my apologies for making it happen on the hackers list.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 1999-01-31 03:27:38 Re: vacuumdb?
Previous Message Charles Hornberger 1999-01-31 02:35:04 Re: [HACKERS] nested loops in joins, ambiguous rewrite rules