pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
(no subject)
2+ messages / 2 participants
[nested] [flat]

* (no subject)
@ 2000-10-30 12:36 Lengyel Ferenc <lengyel@hell.ditec.sk>
  2000-10-30 12:55 ` Re: Yury Don <yura@vpcit.ru>
  0 siblings, 1 reply; 2+ messages in thread

From: Lengyel Ferenc @ 2000-10-30 12:36 UTC (permalink / raw)
  To: 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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re:
  2000-10-30 12:36 (no subject) Lengyel Ferenc <lengyel@hell.ditec.sk>
@ 2000-10-30 12:55 ` Yury Don <yura@vpcit.ru>
  0 siblings, 0 replies; 2+ messages in thread

From: Yury Don @ 2000-10-30 12:55 UTC (permalink / raw)
  To: pgsql-sql

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-10-30 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-10-30 12:36  Lengyel Ferenc <lengyel@hell.ditec.sk>
2000-10-30 12:55 ` Re: Yury Don <yura@vpcit.ru>

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