Re: SERIAL or INT8 / Unique BLOB's - Mailing list pgsql-general

From Dave Trombley
Subject Re: SERIAL or INT8 / Unique BLOB's
Date
Msg-id 3C33CCE3.8050806@bumba.net
Whole thread Raw
In response to Re: SERIAL or INT8 / Unique BLOB's  ("Jeffrey W. Baker" <jwbaker@acm.org>)
Responses Re: SERIAL or INT8 / Unique BLOB's  ("Jeffrey W. Baker" <jwbaker@acm.org>)
List pgsql-general
Jeffrey W. Baker wrote:

>
>yabbut, has anyone seen yet if 7.2 can use bigint in an index (on a 32-bit
>machine)?
>

I don't see why it wouldn't!  gcc has supported 8-byte longs for a
(*sigh*) long, long, time now. =)
This is on my i686-class linux box, build of yesterday's CVS snapshot:

test=# create table ttab(a int, b serial8);
NOTICE:  CREATE TABLE will create implicit sequence 'ttab_b_seq' for
SERIAL column 'ttab.b'
NOTICE:  CREATE TABLE / UNIQUE will create implicit index 'ttab_b_key'
for table 'ttab'
CREATE
test=# CREATE INDEX ttab_b_idx ON ttab (a);
CREATE
test=# CREATE FUNCTION populate(int) RETURNS bool AS '
test'#  BEGIN
test'#   FOR i IN 1..$1 LOOP
test'#    INSERT INTO ttab(a) VALUES((i*i)%133);
test'#   END LOOP;
test'#   RETURN true;
test'#  END; ' language 'plpgsql';
CREATE
test=# select populate(90000);
test=# EXPLAIN SELECT * FROM ttab WHERE a = 30 LIMIT 18;
NOTICE:  QUERY PLAN:

Limit  (cost=0.00..17.07 rows=5 width=12)
  ->  Index Scan using ttab_b_idx on ttab  (cost=0.00..17.07 rows=5
width=12)

EXPLAIN
test=# select * from ttab where a = 30 limit 10;
 a  |   b
----+--------
 30 | 136329
 30 | 136315
 30 | 136253
 30 | 136239
 30 | 136196
 30 | 136182
 30 | 136120
 30 | 136106
 30 | 136063
 30 | 136049
(10 rows)

-dj





pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: PostgreSQL GUI
Next
From: Tom Lane
Date:
Subject: Re: SERIAL or INT8 / Unique BLOB's