Received: from mail.dmz.ditec.sk (mail.ditec.sk [62.168.121.1]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id e9UCae278821 for ; Mon, 30 Oct 2000 07:36:41 -0500 (EST) (envelope-from lengyel@hell.ditec.sk) Received: from apps.intra.ditec.sk (hell.dmz.ditec.sk [192.168.1.252]) by mail.dmz.ditec.sk (8.11.1/8.11.1) with ESMTP id e9UCaWl22930 for ; Mon, 30 Oct 2000 13:36:33 +0100 Received: by apps.intra.ditec.sk with Internet Mail Service (5.5.2650.21) id <4TV63ZFA>; Mon, 30 Oct 2000 13:36:31 +0100 Message-ID: From: Lengyel Ferenc To: "'pgsql-sql@postgresql.org'" Subject: Date: Mon, 30 Oct 2000 13:36:23 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.postgresql.org id e9UCaf278822 X-Archive-Number: 200010/3 X-Sequence-Number: 3 Hello everybody! I need some help with a simple query. I've got a problem with getting a maximum value from a very large table (10000000+ rows): I have table: CREATE TABLE TABLE_A ( COL1 INT, COL2 INT, CONSTRAINT PK PRIMARY KEY (COL1, COL2) ) and when I want to get the maximum value for col1: SELECT MAX(COL1) FROM TABLE_A WHERE COL2 = 1 it takes a large amount of time. I created an index on column COL1, but it doesn't work. Bc. Ferenc Lengyel Address: Prievozská 6/A, Bratislava 821 09, Slovakia Phone Number: +421 (7) 58222 222, +421 (7) 58222 407 E-mail address: mailto:lengyel@ditec.sk