From: Peter Darley <pdarley@kinesis-cem.com>
To: Pierre-Frédéric Caillaud <lists@boutiquenumerique.com>
To: pgsql-performance@postgresql.org
Subject: Re: Data type to use for primary key
Date: Tue, 23 Nov 2004 06:59:42 -0800
Message-ID: <PDEOIIFFBIAABMGNJAGPMEHADLAA.pdarley@kinesis-cem.com> (raw)
In-Reply-To: <opshv2gng3cq72hf@musicbox>
All,
Well, you should still escape any strings you're getting from a web page so
you can ensure you're not subject to a SQL insert attack, even if you're
expecting integers.
Thanks,
Peter Darley
-----Original Message-----
From: pgsql-performance-owner@postgresql.org
[mailto:pgsql-performance-owner@postgresql.org]On Behalf Of
Pierre-Frédéric Caillaud
Sent: Monday, November 22, 2004 3:06 PM
To: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Data type to use for primary key
> What is the common approach? Should I use directly the product_code as
> my ID, or use a sequantial number for speed? (I did the same for the
> company_id, this is a 'serial' and not the shor name of the customer.
> I just don't know what is usually done.
Use a serial :
- you can change product_code for a product easily
- you can pass around integers easier around, in web forms for instance,
you don't have to ask 'should I escape this string ?'
- it's faster
- it uses less space
- if one day you must manage products from another source whose
product_code overlap yours, you won't have problems
- you can generate them with a serial uniquely and easily
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: pdarley@kinesis-cem.com, lists@boutiquenumerique.com
Subject: Re: Data type to use for primary key
In-Reply-To: <PDEOIIFFBIAABMGNJAGPMEHADLAA.pdarley@kinesis-cem.com>
References: <opshv2gng3cq72hf@musicbox> <PDEOIIFFBIAABMGNJAGPMEHADLAA.pdarley@kinesis-cem.com>
* 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