X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4C3E89DCBD4 for ; Thu, 22 Dec 2005 10:06:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91756-01 for ; Thu, 22 Dec 2005 10:06:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web35501.mail.mud.yahoo.com (web35501.mail.mud.yahoo.com [66.163.179.125]) by postgresql.org (Postfix) with SMTP id B8BA79DC886 for ; Thu, 22 Dec 2005 10:06:19 -0400 (AST) Received: (qmail 81531 invoked by uid 60001); 22 Dec 2005 14:06:20 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=5mmjtG1wQl2mGkkvgqODnbO6TVkVQygf4A+fYgUG+XP4YRrKdj7HryD3yfdAxCfF/SZHmvcCQ+pZnwJzcRkmtdc4/JbH9Dzbq4PJOtPAF+7nWFg8EU9CVpjMIgEwHiTn60Xh7x58ge1fs8JcogibyVNe0wKkZ4f474G7k0JcFXk= ; Message-ID: <20051222140620.81529.qmail@web35501.mail.mud.yahoo.com> Received: from [201.3.235.213] by web35501.mail.mud.yahoo.com via HTTP; Thu, 22 Dec 2005 14:06:20 GMT Date: Thu, 22 Dec 2005 14:06:20 +0000 (GMT) From: Carlos Benkendorf Subject: Re: ORDER BY costs To: Tom Lane , pgsql-performance@postgresql.org In-Reply-To: <15455.1135193975@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-2008981442-1135260380=:76789" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.543 required=5 tests=[AWL=0.063, DNS_FROM_RFC_ABUSE=0.479, HTML_MESSAGE=0.001] X-Spam-Score: 0.543 X-Spam-Level: X-Archive-Number: 200512/569 X-Sequence-Number: 16390 --0-2008981442-1135260380=:76789 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit I´m not sure but I think the extra runtime of the select statement that has the ORDER BY clause is because the planner decided to sort the result set. Is the sort really necessary? Why not only scanning the primary key index pages and retrieving the rows like the select without the order by clause? Aren´t not the rows retrieved from the index in a odered form? Thanks in advance! Benkendorf --------------------------------- Yahoo! doce lar. Faça do Yahoo! sua homepage. --0-2008981442-1135260380=:76789 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
I´m not sure but I think the extra runtime of the select statement that has the ORDER BY clause is because the planner decided to sort the result set.
 
Is the sort really necessary? Why not only scanning the primary key index pages and retrieving the rows like the select without the order by clause?
 
Aren´t not the rows retrieved from the index in a odered form?
 
Thanks in advance!
 
Benkendorf
 
 
 


Yahoo! doce lar. Faça do Yahoo! sua homepage. --0-2008981442-1135260380=:76789--