How quick is .split()?

hi all

i'm about to enter 300-500 words into a mysql database, which a rails app
will retrieve. i'm wondering which method would be quicker for a server to
perform:

a) retrieving individual words from 300-500 rows in the database, one to a
row.

or

b) have only one row in the table and this is a concatenated string of all
the keywords, which is .split(), with ruby retrieving the values that way.

i was about to ask this to the mysql group, but then thought that it's more
a question about the speed of the ruby .split() method perhaps :slight_smile:

thanks
luke

luke wrote:

hi all

i'm about to enter 300-500 words into a mysql database, which a rails
app will retrieve. i'm wondering which method would be quicker for a
server to perform:

a) retrieving individual words from 300-500 rows in the database, one
to a row.

or

b) have only one row in the table and this is a concatenated string
of all the keywords, which is .split(), with ruby retrieving the
values that way.

i was about to ask this to the mysql group, but then thought that
it's more a question about the speed of the ruby .split() method
perhaps :slight_smile:

Honestly, I would not make performance the paramount criterium here. As
you describe it it sounds as words must be processed separately so I'd
store them as such in the db. Advantages:

- you can create an index on the word column if you need that (maybe
later)

- rows don't grow too long

But maybe the database is not the proper place to store these words at
all. Maybe marshalling an array into a file is better? Are these words
constant? Are they part of the application? These are the questions I'd
ask.

Kind regards

    robert