pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Edoardo Ceccarelli <eddy@axa.it>
Cc: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Cc: pg@fastcrypt.com, "pgsql-jdbc@postgresql.org" <pgsql-jdbc@postgresql.org>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Re: [JDBC] [PERFORM] is a good practice to create an index on the
Date: Wed, 28 Apr 2004 03:32:23 -0500
Message-ID: <20040428083223.GA8384@wolff.to> (raw)
In-Reply-To: <408F679A.9030608@axa.it>
References: <408D3AE8.5020006@axa.it>
	<408DC9E1.8020704@familyhealth.com.au>
	<1083067187.14759.178.camel@localhost.localdomain>
	<408E75C2.5060703@familyhealth.com.au>
	<1083079114.14759.204.camel@localhost.localdomain>
	<408ED3E2.802@axa.it>
	<408F0944.5060608@familyhealth.com.au>
	<408F679A.9030608@axa.it>

On Wed, Apr 28, 2004 at 10:13:14 +0200,
  Edoardo Ceccarelli <eddy@axa.it> wrote:
> do you mean that, declaring an index serial, I'd never have to deal with 
> incrementing its primary key? good to know!

That isn't what is happening. Serial is a special type. It is int plus
a default rule linked to a sequence. No index is created by default
for the serial type. Declaring a column as a primary key will however
create a unique index on that column.

Also note that you should only assume that the serial values are unique.
(This assumes that you don't use setval and that you don't roll a sequence
over.) Within a single session you can assume the sequence values will
be monotonicly increasing. The values that end up in your table can have
gaps. Typically this happens when a transaction rolls back after obtaining
a new value from a sequence. It can also happen if you grab sequence
values in larger blocks (which might be more efficient if a session normally
acquires mulitple values from a particular sequence) than the default 1.

> anyway  in this particular situation I don't need such accurate 
> behaviour: this table is filled up with a lot of data twice per week and 
> it's used only to answer queries.
> I could drop it whenever I want :)

You really don't want to use oids.



view thread (11+ messages)

Message-ID: <20040428083223.GA8384@wolff.to>
Permalink:  ../20040428083223.GA8384@wolff.to/
Also on:    postgresql.org/message-id/20040428083223.GA8384@wolff.to

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: bruno@wolff.to, eddy@axa.it, chriskl@familyhealth.com.au, pgsql-jdbc@postgresql.org, pgsql-admin@postgresql.org
  Subject: Re: [JDBC] [PERFORM] is a good practice to create an index on the
  In-Reply-To: <20040428083223.GA8384@wolff.to>

* 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