Return-Path: owner-postman Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id PAA09885 for postgres-redist; Sat, 6 Aug 1994 15:56:27 -0700 Resent-From: POSTGRES mailing list Resent-Message-Id: <199408062256.PAA09885@nobozo.CS.Berkeley.EDU> Sender: owner-postman@postgres.Berkeley.EDU X-Return-Path: owner-postman Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id PAA09874; Sat, 6 Aug 1994 15:56:27 -0700 Message-Id: <199408062256.PAA09874@nobozo.CS.Berkeley.EDU> X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol From: aoki@CS.Berkeley.EDU (Paul M. Aoki) To: Pei Cao Cc: postgres@postgres.Berkeley.EDU Subject: Re: how is a three-way join implemented? Reply-To: aoki@CS.Berkeley.EDU (Paul M. Aoki) In-reply-to: Your message of Sat, 6 Aug 1994 18:42:42 -0400 <9408062242.AA17476@cs> Date: Sat, 06 Aug 94 15:56:26 -0700 X-Sender: aoki@postgres.Berkeley.EDU Resent-To: postgres-redist@postgres.Berkeley.EDU X-Mts: smtp Resent-Date: Sat, 06 Aug 94 15:56:27 -0700 Resent-XMts: smtp Pei Cao writes: > Does Postgres join small and large1 first, then join the result relation with > large2? Or does it join all three of them together at the same time, if so, > how exactly does it do that? join strategies are determined by a conventional dynamic programming query optimizer patterned after the system r optimizer. %A P. G. Selinger %A M. M. Astrahan %A D. D. Chamberlin %A R. A. Lorie %A T. G. Price %T Access Path Selection in a Relational Database Management System %J PROC 1979 SIGMOD %C Boston, MA %D JUN 1979 %K system r optimizer %P 23-34 query plans are (generally speaking) left-deep binary trees; no more than two tables are joined in a single join operation, though of course more than one join can be going on at once. you can dump query plans using the -d flag to "postmaster" and "postgres". the format isn't documented but you can probably figure out what's going on. note that catalog statistics (on which the optimizer must rely for its cost formulae) are only updated if you run vacuum (all tables) or build an index (just that one table). -- Paul M. Aoki | University of California at Berkeley aoki@CS.Berkeley.EDU | Dept. of EECS, Computer Science Division (#1776) | Berkeley, CA 94720-1776 ============================================================================== To add/remove yourself to/from the POSTGRES mailing list: send mail with the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU" If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and a human will deal with it. DO NOT post to the "postgres" mailing list. ==============================================================================