From: Andrew McMillan <andrew@catalyst.net.nz>
To: Keary Suska <hierophant@pcisys.net>
Cc: Postgres-PHP <pgsql-php@postgresql.org>
Subject: Re: using CURSOR with PHP
Date: 19 May 2002 17:39:24 +1200
Message-ID: <1021786764.12773.66.camel@kant.mcmillan.net.nz> (raw)
In-Reply-To: <B90C56F0.E95B%hierophant@pcisys.net>
References: <B90C56F0.E95B%hierophant@pcisys.net>
On Sun, 2002-05-19 at 13:07, Keary Suska wrote:
>
> > For more complex queries, however, the plans are less likely to differ
> >
> Actually, as you can see with my examples above, the reverse is true, as the
> simple query produced the same plan. The more complex the query, the more
> choices the optimizer has for picking the best case, which unfortunately is
> not always the truly best case.
No, I meant _complex_ plans:
pcno=# explain select * from vwmbradr where centre_id = 56;
NOTICE: QUERY PLAN:
Subquery Scan vwmbradr (cost=636.68..636.68 rows=1 width=418)
-> Sort (cost=636.68..636.68 rows=1 width=418)
-> Nested Loop (cost=0.00..636.67 rows=1 width=418)
-> Nested Loop (cost=0.00..630.67 rows=1 width=340)
-> Nested Loop (cost=0.00..624.68 rows=1
width=254)
-> Index Scan using primary_centre_id_index
on constituents (cost=0.00..622.35 rows=1 width=212)
-> Seq Scan on centres (cost=0.00..1.59
rows=59 width=42)
-> Index Scan using constituents_pkey on
constituents (cost=0.00..5.98 rows=1 width=86)
-> Index Scan using constituents_pkey on constituents
(cost=0.00..5.98 rows=1 width=78)
EXPLAIN
pcno=# explain select * from vwmbradr where centre_id = 56 limit 1;
NOTICE: QUERY PLAN:
Limit (cost=636.68..636.68 rows=1 width=418)
-> Subquery Scan vwmbradr (cost=636.68..636.68 rows=1 width=418)
-> Sort (cost=636.68..636.68 rows=1 width=418)
-> Nested Loop (cost=0.00..636.67 rows=1 width=418)
-> Nested Loop (cost=0.00..630.67 rows=1
width=340)
-> Nested Loop (cost=0.00..624.68 rows=1
width=254)
-> Index Scan using
primary_centre_id_index on constituents (cost=0.00..622.35 rows=1
width=212)
-> Seq Scan on centres
(cost=0.00..1.59 rows=59 width=42)
-> Index Scan using constituents_pkey on
constituents (cost=0.00..5.98 rows=1 width=86)
-> Index Scan using constituents_pkey on
constituents (cost=0.00..5.98 rows=1 width=78)
EXPLAIN
:-)
Cheers,
Andrew.
--
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267
Are you enrolled at http://schoolreunions.co.nz/ yet?
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: andrew@catalyst.net.nz, hierophant@pcisys.net
Subject: Re: using CURSOR with PHP
In-Reply-To: <1021786764.12773.66.camel@kant.mcmillan.net.nz>
References: <B90C56F0.E95B%hierophant@pcisys.net> <1021786764.12773.66.camel@kant.mcmillan.net.nz>
* 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