index on an int8 column

Started by Sarah Officeralmost 27 years ago10 messagesgeneral
Jump to latest
#1Sarah Officer
officers@aries.tucson.saic.com

I have a table with a column of type int8. When I try to create an
index on it, the
database protests and gives the following error message:

ERROR: Can't find a default operator class for type 20.

Is there an easy fix for this? I assumed builtin numeric types would
have
default comparison functions.

Also, if I am not posting to the appropriate mailing list, please let me
know.

Thanks in advance,

Sarah Officer
officers@aries.tucson.saic.com

#2José Soares
jose@sferacarta.com
In reply to: Sarah Officer (#1)
Re: [GENERAL] index on an int8 column

It works on 6.5beta1.

Sarah Officer ha scritto:

I have a table with a column of type int8. When I try to create an
index on it, the
database protests and gives the following error message:

ERROR: Can't find a default operator class for type 20.

Is there an easy fix for this? I assumed builtin numeric types would
have
default comparison functions.

Also, if I am not posting to the appropriate mailing list, please let me
know.

Thanks in advance,

Sarah Officer
officers@aries.tucson.saic.com

______________________________________________________________
PostgreSQL 6.5.0 on i586-pc-linux-gnu, compiled by gcc 2.7.2.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jose'

#3Bruce Tong
zztong@laxmi.ev.net
In reply to: José Soares (#2)
Row Count?

This is probably one of those things everyone knows except me, but my
search of the documentation only turned up it's not a keyword in
PostgreSQL...

SELECT * FROM foo WHERE ROW_COUNT < 10;

Is there anything like "ROW_COUNT" or "ROWCOUNT" in PostgreSQL?

I've been looking through "The Practical SQL Handbook" as I know it is a
significant influence on PostgreSQL, and I haven't found anything similar
there either.

Bruce Tong | Got me an office; I'm there late at night.
Systems Programmer | Just send me e-mail, maybe I'll write.
Electronic Vision / FITNE |
zztong@laxmi.ev.net | -- Joe Walsh for the 21st Century

#4Thomas Reinke
reinke@e-softinc.com
In reply to: Bruce Tong (#3)
Re: [GENERAL] Row Count?

Try
"select count(*) from row"

to get a count of the number of rows.

If trying to receive 10 rows, try

begin;
declare thomas cursor for select * from foo;
fetch 10 in thomas;
end;

Bruce Tong wrote:

This is probably one of those things everyone knows except me, but my
search of the documentation only turned up it's not a keyword in
PostgreSQL...

SELECT * FROM foo WHERE ROW_COUNT < 10;

Is there anything like "ROW_COUNT" or "ROWCOUNT" in PostgreSQL?

I've been looking through "The Practical SQL Handbook" as I know it is a
significant influence on PostgreSQL, and I haven't found anything similar
there either.

Bruce Tong | Got me an office; I'm there late at night.
Systems Programmer | Just send me e-mail, maybe I'll write.
Electronic Vision / FITNE |
zztong@laxmi.ev.net | -- Joe Walsh for the 21st Century

--
------------------------------------------------------------
Thomas Reinke Tel: (416) 460-7021
Director of Technology Fax: (416) 598-2319
E-Soft Inc. http://www.e-softinc.com

#5Bruce Tong
zztong@laxmi.ev.net
In reply to: Thomas Reinke (#4)
Re: [GENERAL] Row Count?

SELECT * FROM foo WHERE ROW_COUNT < 10;
Is there anything like "ROW_COUNT" or "ROWCOUNT" in PostgreSQL?

If trying to receive 10 rows, try

begin;
declare thomas cursor for select * from foo;
fetch 10 in thomas;
end;

Ooo, a cursor. I'll have to look into those. I was thinking I could just
issue "select * from foo" and then only use the first 10 results, but that
seemed like such a waste of time since there's likely to be 100's of
records. Admittedly I'm ignorant of the solution you pose and I'll have to
do some research, but it seems it too might also have the postmaster
return all of the records, of which I would only use 10. Am I wrong?

Bruce Tong | Got me an office; I'm there late at night.
Systems Programmer | Just send me e-mail, maybe I'll write.
Electronic Vision / FITNE |
zztong@laxmi.ev.net | -- Joe Walsh for the 21st Century

#6Wim Ceulemans
wim.ceulemans@nice.be
In reply to: Bruce Tong (#5)
Re: [GENERAL] Row Count?

SELECT * FROM foo WHERE ROW_COUNT < 10;
Is there anything like "ROW_COUNT" or "ROWCOUNT" in PostgreSQL?

Look through the archives with LIMIT.
I believe in postgresql 6.4.2 you can use something like

set QUERY_LIMIT TO '10';

and after you've done:

reset QUERY_LIMIT;

and in 6.5 I think there is even a better way?

Regards

Wim Ceulemans - wim.ceulemans@nice.be
Nice Software Solutions - http://www.nice.be
Eglegemweg 3, 2811 Hombeek - Belgium
Tel +32(0)15 412953 - Fax +32(0)15 412954

#7Thomas Reinke
reinke@e-softinc.com
In reply to: Bruce Tong (#5)
Re: [GENERAL] Row Count?

Bruce Tong wrote:

SELECT * FROM foo WHERE ROW_COUNT < 10;
Is there anything like "ROW_COUNT" or "ROWCOUNT" in PostgreSQL?

If trying to receive 10 rows, try

begin;
declare thomas cursor for select * from foo;
fetch 10 in thomas;
end;

Ooo, a cursor. I'll have to look into those. I was thinking I could just
issue "select * from foo" and then only use the first 10 results, but that
seemed like such a waste of time since there's likely to be 100's of
records. Admittedly I'm ignorant of the solution you pose and I'll have to
do some research, but it seems it too might also have the postmaster
return all of the records, of which I would only use 10. Am I wrong?

Yes. It is designed explicitly for the purpose of limiting the returns.
For example, if you have a database of several million records and
want only 10 to be returned...

For example, a piece of code that wanted to be conservative on memory
usage, while handling millions of records in the database, might issue
(pseudo-code):

begin;
declare thomas cursor for select * from foo;
do
res = fetch 10 in thomas;
iRows = nTuples(res)
process_records;
while(iRows>0);
end;

From a coding perspective, you deal with the results of the fetch just

as if they had come from the select.

Hope this helps

Thomas

Bruce Tong | Got me an office; I'm there late at night.
Systems Programmer | Just send me e-mail, maybe I'll write.
Electronic Vision / FITNE |
zztong@laxmi.ev.net | -- Joe Walsh for the 21st Century

--
------------------------------------------------------------
Thomas Reinke Tel: (416) 460-7021
Director of Technology Fax: (416) 598-2319
E-Soft Inc. http://www.e-softinc.com

#8Bruce Tong
zztong@laxmi.ev.net
In reply to: Thomas Reinke (#7)
Re: [GENERAL] Row Count?

-> set query_limit '10'

set query_limit = '10';

when you are done with it i think the syntax is

-> set query limit

set query_limit = default;

You got me close enough to where I could find it. It was documented, I
just didn't know what to look for originally.

Thanks a bunch!

Bruce Tong | Got me an office; I'm there late at night.
Systems Programmer | Just send me e-mail, maybe I'll write.
Electronic Vision / FITNE |
zztong@laxmi.ev.net | -- Joe Walsh for the 21st Century

#9Michael J Davis
michael.j.davis@tvguide.com
In reply to: Bruce Tong (#8)
RE: [GENERAL] Row Count?

Try:
SELECT * FROM foo WHERE LIMIT 10;

You must have PostgreSQL 6.5 for this to work. It is a new feature.

-----Original Message-----
From: Bruce Tong [SMTP:zztong@laxmi.ev.net]
Sent: Wednesday, May 05, 1999 8:09 AM
To: PostgreSQL General
Subject: [GENERAL] Row Count?

This is probably one of those things everyone knows except me, but
my
search of the documentation only turned up it's not a keyword in
PostgreSQL...

SELECT * FROM foo WHERE ROW_COUNT < 10;

Is there anything like "ROW_COUNT" or "ROWCOUNT" in PostgreSQL?

I've been looking through "The Practical SQL Handbook" as I know it
is a
significant influence on PostgreSQL, and I haven't found anything
similar
there either.

Bruce Tong | Got me an office; I'm there late at
night.
Systems Programmer | Just send me e-mail, maybe I'll write.
Electronic Vision / FITNE |
zztong@laxmi.ev.net | -- Joe Walsh for the 21st Century

#10Dustin Sallings
dustin@spy.net
In reply to: Bruce Tong (#3)
Re: [GENERAL] Row Count?

On Wed, 5 May 1999, Bruce Tong wrote:

Someone has a table with a column named row_count.

# This is probably one of those things everyone knows except me, but my
# search of the documentation only turned up it's not a keyword in
# PostgreSQL...
#
# SELECT * FROM foo WHERE ROW_COUNT < 10;
#
# Is there anything like "ROW_COUNT" or "ROWCOUNT" in PostgreSQL?
#
# I've been looking through "The Practical SQL Handbook" as I know it is a
# significant influence on PostgreSQL, and I haven't found anything similar
# there either.
#
#
# Bruce Tong | Got me an office; I'm there late at night.
# Systems Programmer | Just send me e-mail, maybe I'll write.
# Electronic Vision / FITNE |
# zztong@laxmi.ev.net | -- Joe Walsh for the 21st Century
#
#
#
#

--
SA, beyond.com My girlfriend asked me which one I like better.
pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net>
| Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE
L_______________________ I hope the answer won't upset her. ____________