[thelist] PHP/MSQL question millions or thousands

Jay Turley jayturley at gmail.com
Wed Feb 6 10:54:28 CST 2008


I recently built a recipe module for a site, and (a small part of)
what I came up with was:

tables: ingredients, recipes, and recipes-ingredients (with a PK of
ingredient_id (FK) , recipe_id (FK))

recipes-ingredients also contained primary_ingredient (BOOL), and
amount (varchar(40)) among other fields

normalizing it like this made it easy to have a recipe index page, a
ingredient index page, and autocompletion of ingredients in a search
box

best of luck

-Jay

On Feb 6, 2008 9:28 AM, Mark A. MacInnes
<mark.macinnes at awakeanddreaming.net> wrote:
> I would definitely put each ingredient into a separate entry. Initially it
> might seem easier to put them all in one field, but having them in one field
> isn't flexible, would make listing recipes by ingredients a pain, would make
> matching recipes to combinations of ingredients a pain, and I would find
> plain messy.
>
> There is much, much more power having the ingredients as separate entries.
>
> Mark
>
>
> On 06/02/2008, Martin Burns <martin at easyweb.co.uk> wrote:
> >
> >
> > On 6 Feb 2008, at 14:04, r937 wrote:
> >
> > >> For those with experience, which is going to be more efficient --
> > >> creating a separate entry for each ingredient (millions of little
> > >> chunks of information) or putting all of the ingredients into one
> > >> entry and searching within that entry (thousands of chunks of
> > >> information that need to be search in)?
> > >
> > > the former
> >
> > Not least because the number of discrete ingredients isn't going to be
> > that high unless you really are going to be deeply specialist about
> > the sourcing of them.
> >
> > Cheers
> > Martin
> >
> > --
> > > Spammers: Send me email -> yumyum at easyweb.co.uk to train my filter
> > > http://dspam.nuclearelephant.com/
> >
> >
> >
> >
> >
> > --
> >
> > * * Please support the community that supports you.  * *
> > http://evolt.org/help_support_evolt/
> >
> > For unsubscribe and other options, including the Tip Harvester
> > and archives of thelist go to: http://lists.evolt.org
> > Workers of the Web, evolt !
> >
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list