From: | Lengyel Ferenc <lengyel(at)hell(dot)ditec(dot)sk> |
---|---|
To: | "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | |
Date: | 2000-10-30 12:36:23 |
Message-ID: | AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)ditec(dot)sk
From | Date | Subject | |
---|---|---|---|
Next Message | Alessandro Rossi | 2000-10-30 12:42:50 | Large Object dump ? |
Previous Message | Marcin Mazurek | 2000-10-30 09:02:13 | select with function per row |