Jump to content
Larry Ullman's Book Forums

Recommended Posts

Well after conducting a quick test (I know its not been repeated, there are many confounding variables and ultimately means nothing) but using SUBSTRING to select all articles beginning with A from a 7000 row dataset took 0.0291 seconds in comparison to 0.3323 seconds using LIKE. I'm sure I could quite easily produce results to the contrary also, depending on the dataset etc... but to me if you want to extract a row that starts with a single character you should test specifically for that character.


That said if I was really worried about performance and using a huge dataset I'd probably add another column as a foreign key to represent the letters as then it could be indexed.



So maybe my table should have each of the letters of the alphabet added as a subset to the Poems field?

Right now I have id, title, poem, category


Would it be better to organize more by adding all letters A-Z as a subset of "Title"?


Thanks for the help.

Link to post
Share on other sites

I don't know what everyone thinks but personally I think that would be overkill for what you're trying to achieve - added complexity for no significant benefits. Unless you plan on storing huge numbers of poems e.g. 500,000 plus (number plucked from thin air) I'd stick to querying on the title field - if you've got 1000, 5000, 10000 poems it won't make any noticeable difference to performance.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...