Обсуждение: Column Type Suggestions
I am in the midst of planning for a new database which will contain specific keywords relating to different products. For example a "Microwave" may have the keywords HOUSEHOLD -> PANASONIC -> CAROUSEL -> CONVECTION -> 2200 WATTS. A pair of Levis may be CLOTHING -> LEVIS -> STONEWASHED -> BOOT CUT -> 36x34. Initially I had planned to use Postgresql's Array Column (keywords varchar(100)[]) but this has some limitations when using the LIKE operator, making searching for specific string of words difficult unless you know firsthand the array key (keywords[2] LIKE 'PANA%'). Does anyone have any suggestions? Product keywords could vary from 1 up to 20, maybe more. Performance isn't a huge issue since the database table will be fairly small and on a local network. Appreciate all the input! NOTE: Using PHP5/Postgresql 8.3
Initially I had planned to use Postgresql's Array Column (keywords
varchar(100)[]) but this has some limitations when using the LIKE operator,
making searching for specific string of words difficult unless you know
firsthand the array key (keywords[2] LIKE 'PANA%').
Does anyone have any suggestions? Product keywords could vary from 1 up to
20, maybe more. Performance isn't a huge issue since the database table will
be fairly small and on a local network. Appreciate all the input! NOTE:
Using PHP5/Postgresql 8.3
Sounds like a seperate table with the primary key of your product table and the keyword you want.
--
Chris Spotts
rfusca@gmail.com
On Thu, Oct 29, 2009 at 9:34 PM, Blake Starkenburg <blake@oldride.com> wrote: > I am in the midst of planning for a new database which will contain specific > keywords relating to different products. For example a "Microwave" may have > the keywords HOUSEHOLD -> PANASONIC -> CAROUSEL -> CONVECTION -> 2200 WATTS. > A pair of Levis may be CLOTHING -> LEVIS -> STONEWASHED -> BOOT CUT -> > 36x34. > > Initially I had planned to use Postgresql's Array Column (keywords > varchar(100)[]) but this has some limitations when using the LIKE operator, > making searching for specific string of words difficult unless you know > firsthand the array key (keywords[2] LIKE 'PANA%'). > > Does anyone have any suggestions? Product keywords could vary from 1 up to > 20, maybe more. Performance isn't a huge issue since the database table will > be fairly small and on a local network. Appreciate all the input! NOTE: > Using PHP5/Postgresql 8.3 Would ltree fit your problem? http://www.postgresql.org/docs/8.4/interactive/ltree.html