- Mailing list pgsql-sql

From Lengyel Ferenc
Subject
Date
Msg-id AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk
Whole thread Raw
Responses Re:
List 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@ditec.sk



pgsql-sql by date:

Previous
From: Marcin Mazurek
Date:
Subject: select with function per row
Next
From: Yury Don
Date:
Subject: Re: