Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X7vSv-0005SG-5g for pgsql-general@arkaria.postgresql.org; Thu, 17 Jul 2014 23:51:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X7vSu-0007LX-3r for pgsql-general@arkaria.postgresql.org; Thu, 17 Jul 2014 23:51:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X7vSs-0007Jw-JN for pgsql-general@postgresql.org; Thu, 17 Jul 2014 23:51:54 +0000 Received: from hogranch.com ([75.101.82.47]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X7vSn-0001yX-C8 for pgsql-general@postgresql.org; Thu, 17 Jul 2014 23:51:53 +0000 Received: from [192.168.0.2] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id s6HNpcZ04571 for ; Thu, 17 Jul 2014 16:51:38 -0700 Message-ID: <53C86185.2020506@hogranch.com> Date: Thu, 17 Jul 2014 16:51:33 -0700 From: John R Pierce User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Re: Checkpoint_segments optimal value References: <20140717140103.4e8c05e8ef5b89817b4d160a@potentialtech.com> <7639.1405620388@sss.pgh.pa.us> In-Reply-To: Content-Type: multipart/alternative; boundary="------------090001010602090408050902" X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org This is a multi-part message in MIME format. --------------090001010602090408050902 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/17/2014 11:28 AM, Prabhjot Sheena wrote: > > SELECT account.id , account.organization_id, > run.application_id, work_unit.script, work_unit.id > , work_unit.start_time, run.id , > work_unit.priority FROM work_unit, run, account WHERE > work_unit.status = 3 AND work_unit.run_id = run.id AND > work_unit.type != 1 AND run.status = 1 AND run.account_id = account.id > that query is an implied 3-way join. it would be clearer to write it like... SELECT account.id , account.organization_id, run.application_id, work_unit.script, work_unit.id , work_unit.start_time, run.id , work_unit.priority FROM work_unit JOIN run ON work_unit.run_id = run.id JOIN account ON run.account_id = account.id WHERE work_unit.status = 3 AND work_unit.type != 1 AND run.status = 1; postgres would (or at least should) treat this exactly the same, but its clearer what the query is doing when its written this way. -- john r pierce 37N 122W somewhere on the middle of the left coast --------------090001010602090408050902 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 7/17/2014 11:28 AM, Prabhjot Sheena wrote:

SELECT account.id, account.organization_id, run.application_id, work_unit.script, work_unit.id, work_unit.start_time, run.id, work_unit.priority  FROM work_unit, run, account  WHERE  work_unit.status = 3 AND work_unit.run_id = run.id AND work_unit.type != 1 AND run.status = 1 AND run.account_id = account.id

that query is an implied 3-way join.  it would be clearer to write it like...

SELECT account.id, account.organization_id, run.application_id, work_unit.script, work_unit.id, work_unit.start_time, run.id, work_unit.priority 
    FROM work_unit
        JOIN run ON work_unit.run_id = run.id
        JOIN account  ON run.account_id = account.id
    WHERE work_unit.status = 3 AND work_unit.type != 1 AND run.status = 1;

postgres would (or at least should) treat this exactly the same, but its clearer what the query is doing when its written this way.


-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast
--------------090001010602090408050902--