From: Yury Don <yura@vpcit.ru>
To: pgsql-sql@postgresql.org
Subject: Re:
Date: Mon, 30 Oct 2000 17:55:04 +0500
Message-ID: <18130913295.20001030175504@vpcit.ru> (raw)
In-Reply-To: <AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk>
References: <AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: yura@vpcit.ru
Subject: Re:
In-Reply-To: <18130913295.20001030175504@vpcit.ru>
References: <AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk> <18130913295.20001030175504@vpcit.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox