how quick is .split()?

L

luke

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 :)

thanks
luke
 
R

Robert Klemme

luke said:
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 :)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,175
Messages
2,570,942
Members
47,491
Latest member
mohitk

Latest Threads

Top