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 961F69DC806 for ; Thu, 23 Feb 2006 08:35:58 -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 35107-02 for ; Thu, 23 Feb 2006 08:36:00 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 0204B9DC876 for ; Thu, 23 Feb 2006 08:35:56 -0400 (AST) Received: from server19320152131.serverpool.info (server19320152131.serverpool.info [193.201.52.131]) by svr4.postgresql.org (Postfix) with ESMTP id 5B16E5AF84B for ; Thu, 23 Feb 2006 12:35:58 +0000 (GMT) Received: from [192.168.0.83] (p548EE499.dip.t-dialin.net [84.142.228.153]) by server19320152131.serverpool.info (Postfix) with ESMTP id 4F80A190058 for ; Thu, 23 Feb 2006 13:35:52 +0100 (CET) Message-ID: <43FDAC27.7050305@profiling-company.de> Date: Thu, 23 Feb 2006 13:35:51 +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: pgsql-performance@postgresql.org Subject: Created Index is not used 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 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200602/362 X-Sequence-Number: 17348 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; A prepending "EXPLAIN" to the statement reveals a seq scan: EXPLAIN SELECT * FROM table WHERE id = 600000; "Seq Scan on table (cost=0.00..15946.48 rows=2 width=74)" " Filter: (id = 600000)" I tried a full vacuum and a reindex, but had no effect. Why is PostgreSQL not using the created index? Or is there any other way to improve performance on this query? The PostgreSQL installation is an out of the box installation with no further optimization. The server is running SUSE Linux 9.1, kernel 2.6.4-52-smp. (Quad Xeon 2.8GHz, 1GB RAM) SELECT version(); "PostgreSQL 7.4.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.3 (SuSE Linux)" Thanks for any hints, Kjeld