Received: from bubbles.electricutopia.net (bubbles.electricutopia.net [63.214.178.76]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f29M2tx31510 for ; Fri, 9 Mar 2001 17:02:55 -0500 (EST) (envelope-from dave@slickness.org) Received: from localhost (dave@localhost) by bubbles.electricutopia.net (8.9.3/8.9.3) with ESMTP id OAA05893 for ; Fri, 9 Mar 2001 14:00:56 -0800 Date: Fri, 9 Mar 2001 14:00:56 -0800 (PST) From: David Olbersen X-X-Sender: To: Subject: Optimization via explicit JOINs Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200103/204 X-Sequence-Number: 1858 Greetings, I've been toying aroudn with postgres 7.1beta5's ability to control the planner via explicitely JOINing tables. I then (just for giggles) compare the difference in the EXPLAIN results. I'm no super-mondo-DBA or anything, but in my two attempts so far, the numbers I get out of EXPLAIN have been about 1/2 as small. Below are two EXPLAIN results, am I correct in reading that one is indeed "twice as fast" as the other? I say twice as fast because the top-most cost in the first query is 58.62, but in the second one it's only 32.09. Am I reading this correctly? -- First EXPLAIN -- Sort (cost=58.62..58.62 rows=14 width=60) -> Nested Loop (cost=0.00..58.35 rows=14) -> Nested Loop (cost=0.00..29.99 rows=14) -> Seq Scan on playlist p (cost=0.00..1.61 rows=14) -> Index Scan using songs_pkey on songs s (cost=0.00..2.01 rows=1) -> Index Scan using artists_pkey on artists a (cost=0.00..2.01 rows=1) -- Second EXPLAIN -- Sort (cost=32.09..32.09 rows=1) -> Nested Loop (cost=0.00..32.08 rows=1) -> Nested Loop (cost=0.00..30.06 rows=1) -> Seq Scan on playlist p (cost=0.00..1.61 rows=14) -> Index Scan using songs_pkey on songs s (cost=0.00..2.02 rows=1) -> Index Scan using artists_pkey on artists a (cost=0.00..2.01 rows=1) -- Dave