X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 62D9956499 for ; Mon, 21 Mar 2005 11:35:48 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53445-04 for ; Mon, 21 Mar 2005 11:35:46 +0000 (GMT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id DCEE356488 for ; Mon, 21 Mar 2005 11:35:44 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 4.42) id 1DDLA2-0001EV-5n; Mon, 21 Mar 2005 11:33:31 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id AE1B616A37; Mon, 21 Mar 2005 11:35:42 +0000 (GMT) Message-ID: <423EB18D.50403@archonet.com> Date: Mon, 21 Mar 2005 11:35:41 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mihail Nasedkin , pgsql-sql Subject: Re: index scan References: <10520036015.20050321132621@mail.ru> <423E90BC.80501@archonet.com> <12025880984.20050321150346@mail.ru> In-Reply-To: <12025880984.20050321150346@mail.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.061 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/282 X-Sequence-Number: 20761 Please CC the list as well as replying directly to me. I don't read this email address often. Mihail Nasedkin wrote: > > RH> Why do you want an index scan? Do you have any evidence it will be > RH> faster than a sequential scan? > > No, but I want to be ready for make Index scan queries in future. I > make first steps on the customize SQL. PostgreSQL uses statistics on what values are in what columns to decide how to plan a query. So - if you are asking for all rows from a table it probably won't use an index because it knows you will have to read the whole table anyway. > Where I can read more about optimize the SQL-queries and about > differences between types of scan? Well, perhaps the best place to learn more is the performance mailing list. You can see plenty of real-world problems being discussed there. Two sections of the manual you should read are Chapter 13. Performance Tips Chapter 23. Monitoring Database Activity Understanding how to read EXPLAIN ANALYSE output and manage statistics are vital. Finally, details on configuration settings can be found at: http://www.powerpostgresql.com/PerfList http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php -- Richard Huxton Archonet Ltd