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 724D49DC9F9 for ; Thu, 23 Feb 2006 10:09:10 -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 59680-04 for ; Thu, 23 Feb 2006 10:09:14 -0400 (AST) X-Greylist: delayed 01:33:15.577642 by SQLgrey- Received: from server19320152131.serverpool.info (server19320152131.serverpool.info [193.201.52.131]) by postgresql.org (Postfix) with ESMTP id AB1869DC9A1 for ; Thu, 23 Feb 2006 10:09:07 -0400 (AST) Received: from [192.168.0.83] (p548EE499.dip.t-dialin.net [84.142.228.153]) by server19320152131.serverpool.info (Postfix) with ESMTP id 2F74A190058; Thu, 23 Feb 2006 15:09:11 +0100 (CET) Message-ID: <43FDC206.2090102@profiling-company.de> Date: Thu, 23 Feb 2006 15:09:10 +0100 From: Kjeld Peters User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051019) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Markus Schaber Cc: pgsql-performance@postgresql.org Subject: Re: Created Index is not used References: <43FDAC27.7050305@profiling-company.de> <43FDAE8A.60805@logix-tt.com> In-Reply-To: <43FDAE8A.60805@logix-tt.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200602/366 X-Sequence-Number: 17352 Hi Markus, first of all thanks for your quick reply! Markus Schaber wrote: > Kjeld Peters wrote: >>Select and update statements are quite slow on a large table with more >>than 600,000 rows. The table consists of 11 columns (nothing special). >>The column "id" (int8) is primary key and has a btree index on it. >> >>The following select statement takes nearly 500ms: >> >>SELECT * FROM table WHERE id = 600000; > > > Known issue which is fixed in 8.X servers, postgreSQL sees your 600000 > as int4 literal and does not grasp that the int8 index works for it. > > SELECT * FROM table WHERE id = 600000::int8; > > should do it. After I appended "::int8" to the query, selecting the table takes only 40-50ms. That's a great performance boost! > Btw, you should update to 7.4.12, there are importand bug fixes and it > is upgradable "in place", without dumping and reloading the database. I guess I'll test an upgrade to version 8.1. Thanks again for your and Ragnar's help! Kjeld