pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lengyel Ferenc <lengyel@hell.ditec.sk>
To: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Date: Mon, 30 Oct 2000 13:36:23 +0100
Message-ID: <AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk> (raw)

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




view thread (2+ messages)  latest in thread

Message-ID: <AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk>
Permalink:  ../AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk/
Also on:    postgresql.org/message-id/AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk

 · 

reply

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: lengyel@hell.ditec.sk
  Subject: Re: 
  In-Reply-To: <AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk>
  References: <AFC8540FEA0CF146A0256CEEC7FCEC6F043A77@apps.intra.ditec.sk>

* 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