Re: disabling OIDs?

Lists: pgsql-general
From: Lonni J Friedman <netllama(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: disabling OIDs?
Date: 2004-12-13 02:51:08
Message-ID: 7c1574a904121218516e2989c1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

The spam filtering package I use (dspam) had a section in their
release notes recently which stated that disabling OIDs greatly
increased speeds, and so they suggested that people do that on their
tables.

When creating new tables, you can disable OIDs with,
CREATE TABLE foo (...) WITHOUT OIDS;
And you can disable OIDs on existing tables by executing for each table,
ALTER TABLE foo SET WITHOUT OIDS;
and then running a vacuumdb (either with pg_vacuumdb or VACUUM ANALYSE;)

Does anyone know of any risks or potential downsides to doing this?

Thanks!

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman netllama(at)gmail(dot)com
LlamaLand http://netllama.linux-sxs.org


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Lonni J Friedman <netllama(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: disabling OIDs?
Date: 2004-12-13 03:16:27
Message-ID: 14934.1102907787@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Lonni J Friedman <netllama(at)gmail(dot)com> writes:
> The spam filtering package I use (dspam) had a section in their
> release notes recently which stated that disabling OIDs greatly
> increased speeds, and so they suggested that people do that on their
> tables.

"greatly increased"? I doubt it.

Last I heard, dspam was not noted for any large amount of cluefulness
WRT postgres. It was only recently that we managed to talk them out of
their most egregious bits of mysql-centricity. Going to them for
postgres tuning tips is about like coming to me for mysql tuning ...

regards, tom lane


From: Lonni J Friedman <netllama(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: disabling OIDs?
Date: 2004-12-13 04:25:53
Message-ID: 7c1574a904121220253ae4a5b2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Sun, 12 Dec 2004 22:16:27 -0500, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Lonni J Friedman <netllama(at)gmail(dot)com> writes:
> > The spam filtering package I use (dspam) had a section in their
> > release notes recently which stated that disabling OIDs greatly
> > increased speeds, and so they suggested that people do that on their
> > tables.
>
> "greatly increased"? I doubt it.
>
> Last I heard, dspam was not noted for any large amount of cluefulness
> WRT postgres. It was only recently that we managed to talk them out of
> their most egregious bits of mysql-centricity. Going to them for
> postgres tuning tips is about like coming to me for mysql tuning ...
>

OK, thanks. So is there any real benefit in doing this in a generic
(non-dspam) sense, or is it just a hack that wouldn't be noticable?
Any risks or potential problems down the line?

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman netllama(at)gmail(dot)com
LlamaLand http://netllama.linux-sxs.org


From: Neil Conway <neilc(at)samurai(dot)com>
To: Lonni J Friedman <netllama(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: disabling OIDs?
Date: 2004-12-13 04:52:45
Message-ID: 1102913565.23208.50.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Sun, 2004-12-12 at 20:25 -0800, Lonni J Friedman wrote:
> OK, thanks. So is there any real benefit in doing this in a generic
> (non-dspam) sense, or is it just a hack that wouldn't be noticable?
> Any risks or potential problems down the line?

It saves 4 bytes per row; depending on alignment and padding
considerations, that may or may not equate to disk space savings. Other
than the inability to use OIDs on the table, there is no real risks to
doing this -- I'm planning to advocate making WITHOUT OIDS the default
in PostgreSQL 8.1+. You can get this behavior in 8.0 by setting the
default_with_oids config variable to "false".

-Neil


From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: disabling OIDs?
Date: 2004-12-13 06:07:10
Message-ID: 87pt1ewx2p.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


Lonni J Friedman <netllama(at)gmail(dot)com> writes:

> OK, thanks. So is there any real benefit in doing this in a generic
> (non-dspam) sense, or is it just a hack that wouldn't be noticable?
> Any risks or potential problems down the line?

OIDs increase the storage requirements so they do slow postgres somewhat.
About (exactly?) the same impact as adding another integer column. That will
have a bigger impact on a narrow table than wider tables.

--
greg


From: Jeff Davis <jdavis-pgsql(at)empires(dot)org>
To: Lonni J Friedman <netllama(at)gmail(dot)com>
Cc: PgSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: disabling OIDs?
Date: 2005-01-02 02:35:30
Message-ID: 1104633330.3003.434.camel@jeff
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Sun, 2004-12-12 at 20:25 -0800, Lonni J Friedman wrote:
> OK, thanks. So is there any real benefit in doing this in a generic
> (non-dspam) sense, or is it just a hack that wouldn't be noticable?
> Any risks or potential problems down the line?
>
>

I'd just like to add that some 3rd party applications/interfaces make
use of OIDs, as a convenient id to use if there is no primary key (or if
the 3rd party software doesn't take the time to find the primary key).

One might argue that those 3rd party applications/interfaces are broken,
but you still might want to keep OIDs around in case you have a use for
one of those pieces of software.

Regards,
Jeff


From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Jeff Davis <jdavis-pgsql(at)empires(dot)org>
Cc: Lonni J Friedman <netllama(at)gmail(dot)com>, PgSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: disabling OIDs?
Date: 2005-01-02 13:24:39
Message-ID: 20050102132438.GA19311@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Sat, Jan 01, 2005 at 06:35:30PM -0800, Jeff Davis wrote:
> On Sun, 2004-12-12 at 20:25 -0800, Lonni J Friedman wrote:
> > OK, thanks. So is there any real benefit in doing this in a generic
> > (non-dspam) sense, or is it just a hack that wouldn't be noticable?
> > Any risks or potential problems down the line?
> >
> I'd just like to add that some 3rd party applications/interfaces make
> use of OIDs, as a convenient id to use if there is no primary key (or if
> the 3rd party software doesn't take the time to find the primary key).
>
> One might argue that those 3rd party applications/interfaces are broken,
> but you still might want to keep OIDs around in case you have a use for
> one of those pieces of software.

Yep, especially since an OID is not a unique value and so can't
possibly be a primary key and generally isn't indexed either. Even
Access asks you to identify the primary key...
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.


From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Jeff Davis <jdavis-pgsql(at)empires(dot)org>, Lonni J Friedman <netllama(at)gmail(dot)com>, PgSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: disabling OIDs?
Date: 2005-01-07 01:42:13
Message-ID: 200501062042.13547.xzilla@users.sourceforge.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Sunday 02 January 2005 08:24, Martijn van Oosterhout wrote:
> On Sat, Jan 01, 2005 at 06:35:30PM -0800, Jeff Davis wrote:
> > On Sun, 2004-12-12 at 20:25 -0800, Lonni J Friedman wrote:
> > > OK, thanks. So is there any real benefit in doing this in a generic
> > > (non-dspam) sense, or is it just a hack that wouldn't be noticable?
> > > Any risks or potential problems down the line?
> >
> > I'd just like to add that some 3rd party applications/interfaces make
> > use of OIDs, as a convenient id to use if there is no primary key (or if
> > the 3rd party software doesn't take the time to find the primary key).
> >
> > One might argue that those 3rd party applications/interfaces are broken,
> > but you still might want to keep OIDs around in case you have a use for
> > one of those pieces of software.
>
> Yep, especially since an OID is not a unique value and so can't
> possibly be a primary key and generally isn't indexed either. Even
> Access asks you to identify the primary key...

Of course some 3rd party apps are nice and they look for a primary key first,
then a unique index, then look for an oid. Furthermore the really clueful
ones will check # of affected rows = 1 when modifying by oid, so its pretty
safe.

--
Robert Treat
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL