Received: from vpcit.ru (dialup.vpcit.ru [195.38.52.246]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id e9UCt2279533 for ; Mon, 30 Oct 2000 07:55:03 -0500 (EST) (envelope-from yura@vpcit.ru) Received: (qmail 4654 invoked from network); 30 Oct 2000 12:54:10 -0000 Received: from gercon.vpcit.ru (195.38.52.226) by dialup.vpcit.ru with SMTP; 30 Oct 2000 12:54:10 -0000 Date: Mon, 30 Oct 2000 17:55:04 +0500 From: Yury Don X-Mailer: The Bat! (v1.47 Halloween Edition) Reply-To: Yury Don Organization: Gercon X-Priority: 3 (Normal) Message-ID: <18130913295.20001030175504@vpcit.ru> To: pgsql-sql@postgresql.org Subject: Re: In-reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200010/4 X-Sequence-Number: 4 Hello Lengyel, Once, Monday, October 30, 2000, 5:36:23 PM, you wrote: LF> Hello everybody! LF> I need some help with a simple query. LF> I've got a problem with getting a maximum value from a very large table LF> (10000000+ rows): LF> I have table: LF> CREATE TABLE TABLE_A LF> ( LF> COL1 INT, LF> COL2 INT, LF> CONSTRAINT PK PRIMARY KEY (COL1, COL2) LF> ) LF> and when I want to get the maximum value for col1: LF> SELECT MAX(COL1) FROM TABLE_A WHERE COL2 = 1 LF> it takes a large amount of time. LF> I created an index on column COL1, but it doesn't work. You need to create index on COL2. -- Best regards, Yury ICQ 11831432 mailto:yura@vpcit.ru