Received: from smtp2.dnb.com (smtp2.dnb.com [204.254.175.103]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id e9UDAH295649 for ; Mon, 30 Oct 2000 08:10:17 -0500 (EST) (envelope-from SchlobohmJ@DNB.com) Received: from relay.us.dnb.com (relay.us.dnb.com [159.137.225.58]) by smtp2.dnb.com (8.9.3/8.9.3) with ESMTP id IAA20687 for ; Mon, 30 Oct 2000 08:10:10 -0500 (EST) Received: from smtp-gw.us.dnb.com (smtp-gw.us.dnb.com [159.137.225.51]) by relay.us.dnb.com (8.9.3/8.9.3) with SMTP id IAA02855 for ; Mon, 30 Oct 2000 08:10:11 -0500 (EST) Received: from 159.137.224.39 by smtp-gw.us.dnb.com with ESMTP ( WorldSecure Server SMTP Relay(WSS) v4.0.2); Mon, 30 Oct 00 08:01:53 -0500 X-Server-Uuid: 512bef52-27db-11d3-8937-0008c7cf307c Received: by exbhbhbh02.us.dbisna.com with Internet Mail Service ( 5.5.2650.21) id ; Mon, 30 Oct 2000 08:10:10 -0500 From: "Schlobohm, Jack" To: "'pgsql-sql@postgresql.org'" Subject: RE: Date: Mon, 30 Oct 2000 07:52:28 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) X-WSS-ID: 15E3AECB85501-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15E3AECB85501-01@WorldSecure_Server__smtp-gw.us.dnb.com_> X-Archive-Number: 200010/6 X-Sequence-Number: 6 Can I be removed from this mailing list? > -----Original Message----- > From: Yury Don [SMTP:yura@vpcit.ru] > Sent: Monday, October 30, 2000 6:55 AM > To: pgsql-sql@postgresql.org > Subject: Re: [SQL] > > 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 > >