pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Josh Goldberg <josh@4dmatrix.com>
To: pgsql-admin@postgresql.org
Subject: experimenting with coalesce, strange EXPLAIN results
Date: Thu, 04 Sep 2003 16:07:08 -0700
Message-ID: <3F57C59C.9060600@4dmatrix.com> (raw )
I was experimenting with moving some of my case logic out of the
application and into sql and found a strange EXPLAIN result with one of
my COALESCE statements. Why is each subselect listed twice? This is in
7.3.4 on freebsd 4.8.
cms3=# explain analyze select coalesce ((sELECT thumb FROM content_group_descriptor WHERE content_group_id = 140 AND language_id = 1),(SELECT tc.file FROM thumbnail_content tc, ccl WHERE tc.parent_content_id = cid AND ccgid = 140 limit 1));
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------
Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.98..0.98 rows=1 loops=1)
InitPlan
-> Seq Scan on content_group_descriptor (cost=0.00..2.78 rows=1 width=4) (actual time=0.10..0.10 rows=0 loops=1)
Filter: ((content_group_id = 140) AND (language_id = 1))
-> Seq Scan on content_group_descriptor (cost=0.00..2.78 rows=1 width=4) (never executed)
Filter: ((content_group_id = 140) AND (language_id = 1))
-> Limit (cost=0.00..8.43 rows=1 width=12) (actual time=0.35..0.42 rows=1 loops=1)
-> Nested Loop (cost=0.00..14.94 rows=2 width=12) (actual time=0.34..0.40 rows=2 loops=1)
-> Seq Scan on content_collection (cost=0.00..5.46 rows=1 width=4) (actual time=0.24..0.26 rows=3 loops=1)
Filter: (content_collection_group_id = 140)
-> Index Scan using parent_file_key on thumbnail_content tc (cost=0.00..6.83 rows=1 width=8) (actual time=0.02..0.02 rows=1 loops=3)
Index Cond: (tc.parent_content_id = "outer".content_id)
-> Limit (cost=0.00..8.43 rows=1 width=12) (actual time=0.32..0.39 rows=1 loops=1)
-> Nested Loop (cost=0.00..14.94 rows=2 width=12) (actual time=0.31..0.37 rows=2 loops=1)
-> Seq Scan on content_collection (cost=0.00..5.46 rows=1 width=4) (actual time=0.24..0.26 rows=3 loops=1)
Filter: (content_collection_group_id = 140)
-> Index Scan using parent_file_key on thumbnail_content tc (cost=0.00..6.83 rows=1 width=8) (actual time=0.01..0.02 rows=1 loops=3)
Index Cond: (tc.parent_content_id = "outer".content_id)
Total runtime: 1.14 msec
(19 rows)
view thread (2+ messages) latest in thread
Message-ID: <3F57C59C.9060600@4dmatrix.com>
Permalink: ../3F57C59C.9060600@4dmatrix.com/
Also on: postgresql.org/message-id/3F57C59C.9060600@4dmatrix.com
copy link · copy postgr.es
reply 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-admin@postgresql.org
Cc: josh@4dmatrix.com
Subject: Re: experimenting with coalesce, strange EXPLAIN results
In-Reply-To: <3F57C59C.9060600@4dmatrix.com>
References: <3F57C59C.9060600@4dmatrix.com>
* 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