Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 951147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:41:07+00:00 2026-05-15T23:41:07+00:00

Is there an alternative for LIKE. Note I cannot use FULL TEXT Search. Here

  • 0

Is there an alternative for LIKE. Note I cannot use FULL TEXT Search.

Here is my mysql code.

SELECT * 
FROM question 
WHERE content LIKE '%$search_each%'
OR title LIKE '%$search_each%'
OR summary LIKE '%$search_each%'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:41:08+00:00Added an answer on May 15, 2026 at 11:41 pm

    Well, MySQL has regular expressions but I would like to ask you what the problem is with multiple LIKEs.

    I know it won’t scale well when tables get really large but that’s rarely a concern for the people using MySQL (not meaning to be disparaging to MySQL there, it’s just that I’ve noticed a lot of people seem to use it for small databases, leaving large ones to the likes of Oracle, DB2 or SQLServer (or NoSQL where ACID properties aren’t so important)).

    If, as you say:

    I plan to use it for really large sites.

    then you should avoid LIKE altogether. And, if you cannot use full text search, you’ll need to roll your own solution.

    One approach we’ve used in the past is to use insert/update/delete triggers on the table to populate yet another table. The insert/update trigger should:

    • evaluate the string in question;
    • separate it into words;
    • throw away inconsequential words (all-numerics, noise words like ‘at’, ‘the’, ‘to’, and so on); then
    • add those words to a table which a marker to the row in the original table.

    Then use that table for searching, almost certainly much faster than multiple LIKEs. It’s basically a roll-your-own sort-of-full text search where you can fine-tune and control what actually should be indexed.

    The advantage of this is speed during the select process with a minor cost during the update process. Keep in mind this is best for tables that are read more often than written (most of them) since it amortises the cost of indexing the individual words across all reads. There’s no point in incurring that cost on every read, better to do it only when the data changes.

    And, by the way, the delete trigger will simply delete all entries in the indexing table which refer to the real record.

    The table structures would be something like:

    Comments:
        id          int
        comment     varchar(200)
        -- others.
        primary key (id)
    
    Words:
        id          int
        word        varchar(50)
        primary key (id)
        index       (word)
    
    WordsInComments:
        wordid      int
        commentid   int
        primary key (wordid,commentid)
        index       (commentid)
    

    Setting the many-to-many relationship to id-id (i.e., separate Words and WordsInComments tables) instead of id-text (combining them into one) is the correct thing to do for third normal form but you may want to look at trading off storage space for speed and combining them, provided you understand the implications.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any alternative to use like tag to property of UIView? The thing
There's a question that looks like this one here: Create my own classList object
Is there any alternative to this: Organizations.Include(Assets).Where(o => o.Id == id).Single() I would like
Is there some alternative IDE for developing for Adruino I tried to use Eclipe
NOTE: This question is only loosely related to tinyxml, however including details like that
I would like to use existing Delphi code to write SQL Server stored procedures.
Is there an alternative to using Google C2DM for push notifications with Android? I
Is there an alternative to CodeIgniter's Sparks package management in ZF and Yii? Sparks
Is there an alternative to using ActiveWorkbook and ActiveSheet in VBA when working with
Is there an alternative container that has the same functionality as std::map but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.