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 6475071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:39:42+00:00 2026-05-25T06:39:42+00:00

I’m developing a big content site, with a table contents, with more than 50

  • 0

I’m developing a big content site, with a table “contents”, with more than 50 Million of records. Here’s the table structure:

contain id(INT11 INDEX), 
name(varchar150 FULLTEXT), 
description (text FULLTEXT), 
date(INT11 INDEX)

I wan to add a “tags” to this contents.

I’m think 2 methods:

  1. Make a varchar(255 FULLTEXT) “tags” column in table contents. Store all tags separated by comas, and search row by row (Which I think this will be slow) using MATCH & AGAINS.

  2. Make 2 tables. First table name “tags” with columns id, tag(varchar(30 INDEX or FULLTEXT?)), “contents_tags” with id, tag_id (int11 INDEX) and content_id (int11 INDEX) and search contents by a JOINS of 3 tables (contents – contents_tags – tags) to retrieve all contents with the tag(s).

I think this is slow and memory killer because a ENORMOUS JOIN of 50M
table * contents_tags * tags.

What is the best method to store tags to make it as efficient as possible? What is the fastest way to search by a text (for example “movie 3d 2011” and simple tag “video”) and to locate contents.?

The size of the table (approx. 5Gb now without tags). The table is a MYISAM because I need to store name and description of the table contents in FULLTEXT to string search (users ca search now by this fields), and need the best speed to search by tags.

Any with experience in this?

Thanks!

  • 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-25T06:39:43+00:00Added an answer on May 25, 2026 at 6:39 am

    FULLTEXT indexes are really not as fast as you may think they are.

    Use a separate table to store your tags:

    Table tags
    ----------
    id integer PK
    tag varchar(20)
    
    Table tag_link
    --------------
    tag_id integer foreign key references tag(id)
    content_id integer foreign key references content(id)
    /* this table has a PK consisting of tag_id + content_id */
    
    Table content
    --------------
    id integer PK
    ......
    

    You SELECT all content with tag x by using:

    SELECT c.* FROM tags t
    INNER JOIN tag_link tl ON (t.id = tl.tag_id)
    INNER JOIN content c ON (c.id = tl.content_id)
    WHERE tag = 'test'
    ORDER BY tl.content_id DESC /*latest content first*/
    LIMIT 10;
    

    Because of the foreign key, all fields in tag_links are individually indexed.
    The `WHERE tags = ‘test’ selects 1 (!) record.
    Equi-joins this with 10,000 taglinks.
    And Equi-joins that with 1 content record each (each tag_link only ever points to 1 content).
    Because of the limit 10, MySQL will stop looking as soon as it has 10 items, so it really only looks at 10 tag_links records.
    The content.id is autoincrementing, so higher numbers are very fast proxy for newer articles.

    In this case you never need to look for anything other than equality and you start out with 1 tag that you equi-join using integer keys (the fastest join possible).

    There are no if-thens-or-buts about it, this is the fastest way.

    Note that because there are at most a few 1000 tags, any search will be much faster than delving in the full contents table.

    Finally
    CSV fields are a very bad idea, never use then in a database.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
i got an object with contents of html markup in it, for example: string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.