X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 36B48D1B574 for ; Fri, 29 Aug 2003 08:57:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 06763-01 for ; Fri, 29 Aug 2003 05:57:39 -0300 (ADT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by svr1.postgresql.org (Postfix) with ESMTP id 7C24BD1B8AE for ; Fri, 29 Aug 2003 05:57:36 -0300 (ADT) Received: from klaster.net (core-1.citynet.pl [80.48.135.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 508502B3A4; Fri, 29 Aug 2003 10:57:15 +0200 (CEST) Message-ID: <3F4F1575.8090600@klaster.net> Date: Fri, 29 Aug 2003 10:57:25 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.5a) Gecko/20030718 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Alexander Priem Cc: pgsql-performance@postgresql.org Subject: Re: Indexing question References: <012f01c36dfa$0f4a8760$b696a8c0@APR> <3F4EFAB6.7030104@klaster.net> <015f01c36e02$134fe960$b696a8c0@APR> <3F4F07CE.6090803@klaster.net> <018c01c36e09$4893e980$b696a8c0@APR> In-Reply-To: <018c01c36e09$4893e980$b696a8c0@APR> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/485 X-Sequence-Number: 3301 > create index orad_id_index on orderadvice (orad_id) where orad_deleteddate > is null; > create index orad_name_index on orderadvice (orad_name) where > orad_deleteddate is null; > > create view orderadvice_edit as select > orad_id,orad_name,orad_description,orad_value,orad_value_quan from > orderadvice where orad_deleteddate is null; > > Would queries like 'select * from orderadvice_edit where orad_id=100' or > 'select * from orderadvice_edit order by orad_name' both use one of these > two partial indexes, given enough records are present in the table? > > There would be a double index on the primary key this way, right? It looks much better now. I'm not sure about the second index. Probably it will be useless, because you sort ALL records with deleteddtata is null. Maybe the first index will be enough. I'm not sure what to do with doubled index on a primary key field. Regards, Tomasz Myrta