optimization - Mailing list pgsql-sql

From sqyang
Subject optimization
Date
Msg-id 3658CB52.6C41908F@nudt.edu.cn
Whole thread Raw
List pgsql-sql
1. I had install postgresql-v6.4 on my linux2.0.3. And it runs well. I
had created two tables and inserted 2000 tuples in each of them. But
pg_class shows that the two tables both contain 0 tuples and have 0
blocks.

2. I'd like to know what optimizations the postgresql takes for nestloop
join. I list the execution plan of selection statement. I found that the
plan relies only on the order in which the tables occur in the select
list. It seems there is no optimization for nestloop join.Here are four
statements and their result plans.(onek: 1000 tuples, tenk 10000 tuples)
statement:
    select onek.unique1, tenk.unique1 from onek, tenk;
plan:
    Nested Loop  (cost=0.00 size=1 width=8)
      ->  Seq Scan on tenk  (cost=0.00 size=0 width=4)
      ->  Seq Scan on onek  (cost=0.00 size=0 width=4)

statement:
    select onek.unique1, tenk.unique1 from tenk, onek;
plan:
    Nested Loop  (cost=0.00 size=1 width=8)
      ->  Seq Scan on tenk  (cost=0.00 size=0 width=4)
      ->  Seq Scan on onek  (cost=0.00 size=0 width=4)

statement:
    select tenk.unique1, onek.unique1 from onek, tenk;
plan:
    Nested Loop  (cost=0.00 size=1 width=8)
      ->  Seq Scan on onek  (cost=0.00 size=0 width=4)
      ->  Seq Scan on tenk  (cost=0.00 size=0 width=4)

statement:
    select tenk.unique1, onek.unique1 from tenk, onek;
plan:
    Nested Loop  (cost=0.00 size=1 width=8)
      ->  Seq Scan on onek  (cost=0.00 size=0 width=4)
      ->  Seq Scan on tenk  (cost=0.00 size=0 width=4)

Are these conclusions true?
Thanks in advance!

pgsql-sql by date:

Previous
From: Michael Olivier
Date:
Subject: optimizing 2-table join w/millions of rows
Next
From: Michael Olivier
Date:
Subject: Postgres 6.4 binary RPM for RH 5.1?