pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chadwick Rolfs <cmr@shell.gis.net>
To: Gaëtan de Menten <ged@bugfactory.org>
Cc: pgsql-php@postgresql.org
Subject: Re: Simple PHP/pgsql optimization question...
Date: Sat, 18 May 2002 11:47:38 -0400 (EDT)
Message-ID: <Pine.SOL.3.96.1020518114416.1934B-100000@shell.gis.net> (raw)
In-Reply-To: <001601c1fe7e$bf271af0$0701a8c0@trotinette>

On Sat, 18 May 2002, [iso-8859-1] Gaëtan de Menten wrote:

> Hi there all,
> 
> First, I'm far from being a professional programmer in pgsql and PHP and I'm
> new to this list, so please pardon if this question seems stupid to you.
> 
> In my 'projects' tables, among many other fields, I need a 'license' field.
> I need to optimize the display of the list of all projects (+-200 projects
> to display).
> Which solution do you think would be the fastest, and how much faster?
> 
> 1) Have a 'license' table (with and id and a name field) listing all the
> possible licenses and have a foreign key in my 'projects' table pointing to
> that 'license' table.
> the query would look like this:
> select ..., license.name as license from projects, licenses where
> projects.license=license.id and ...
> 
> 2) Have the license field in the 'projects' table be a varchar field and
> store the name of the license directly.
> 
> 3) Have the license field be an int and have an array in PHP listing all the
> licenses.
> 
> 4) another solution?
> 
> I personnaly prefer the first solution since it's the cleanest to my eyes
> but I'm ready to trade that for speed, if another solution is much faster.
> 
> Thanks a lot,
> Gaëtan.

I prefer the first solution also.  You can add or take away liscenses
without having to edit a huge amount of data.  Be sure you do the right
thing with the foreign key.  I would leave most of the data handling to
postgresql and use php to make it accessable(sp?) in a
pretty way....

-Chadwick




view thread (3+ messages)  latest in thread

Message-ID: <Pine.SOL.3.96.1020518114416.1934B-100000@shell.gis.net>
Permalink:  ../Pine.SOL.3.96.1020518114416.1934B-100000@shell.gis.net/
Also on:    postgresql.org/message-id/Pine.SOL.3.96.1020518114416.1934B-100000@shell.gis.net

 · 

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 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-php@postgresql.org
  Cc: cmr@shell.gis.net, ged@bugfactory.org
  Subject: Re: Simple PHP/pgsql optimization question...
  In-Reply-To: <Pine.SOL.3.96.1020518114416.1934B-100000@shell.gis.net>
  References: <001601c1fe7e$bf271af0$0701a8c0@trotinette> <Pine.SOL.3.96.1020518114416.1934B-100000@shell.gis.net>

* 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