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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:12:34+00:00 2026-05-31T23:12:34+00:00

I have a feed table with say fields: id – unique feed id created

  • 0

I have a feed table with say fields:

  • id – unique feed id
  • created – the date the feed was created
  • table – the name of the table the rest of the feed info resides

Then I have say 2 tables: feed_image and feed_text. Now these 2 tables contain different information about a feed, different fields.

How is it possible (in MySQL) to extract the information for the feed from the appropriate table which name is specified in feed.table?

Here is how my schema looks like:

                                                 +------------------+
                                                 |    table_a       |
      +---------------------+                    |------------------|
      |   feed              |                    | id               |
      |---------------------|             +------+ feed_id          |
      |  id         <-------------------+-+      | field_in_a       |
      |  created            |           |        | ...              |
      |  table              |           |        |                  |
      |                     |           |        |                  |
      |                     |           |        |                  |
      |                     |           |        +------------------+
      +---------------------+           |
                                        |
                                        |
                                        |        +-------------------+
                                        |        |   table_b         |
                                        |        |-------------------|
                                        |        |  id               |
                                        +--------+  feed_id          |
                                                 |  field_in_b       |
                                                 |  ...              |
                                                 |                   |
                                                 |                   |
                                                 |                   |
                                                 |                   |
                                                 +-------------------+

Each feed exists either in table_a or table_b or table_c or … (I have like 30 of them).
How can I specify which table to extract the info from (each table has a different structure).

Or, if I add indexes on each table_*.feed_id and map it to feed.id, would InnoDB do some magic, so when I JOIN them all it would look in just one of them, not all 30?

My latest idea is to have just one table feed with a field feed.content where I would store a serialized PHP object of a different PHP class representing the different feed type and its individual contents.

What is the best way to go regarding performance?

P.S.: No records would need to be selected / searched / ordered by individual parameters, just by created. The idea should be able to work well with 1 000 000+ records.

UPDATE:

To clarify about the 30+ table_a/b/c..

Each feed can be of too many different types (new ones will also be added with time):

  • An image feed would have VARCHAR(255) url field
  • A text feed would have LONGTEXT text field
  • A youtube.com feed would have VARCHAR(255) title, VARCHAR(255) video_id fields
  • A *.com feed would have * x1, * x2, * x3 … fields

Each of these feeds will be then displayed with PHP according to type:

  • An image will be displayed as na image from the given URL
  • A text will be displayed as a pure text
  • A youtube.com feed would display a video player with the given title from the given video id
  • A *.com feed would display… 🙂
  • 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-31T23:12:35+00:00Added an answer on May 31, 2026 at 11:12 pm

    I would use a LEFT JOIN and alias my columns in the select and alias my tables in the join allowing you to return any and all information you need.

    The with whatever language your pulling the results you can group and perform logic as necessary.

    UPDATE:

    Why do you have 30 tables exactly? Maybe one “meta” table with the feed creation date url it came from etc… and another table that contains a unique record id, feed id, content, content type.

    That way you can join on one table where feed id’s match as well as group by or filter by content type.

    Visualization: Feed table

    --------------------------------------------------------------
    |  feed_id   | feed_name  |  feed_created     |   Feed_url   |
    --------------------------------------------------------------
    |     1      | Feed 1     |  03/28/2012       |  www.go.com  |
    --------------------------------------------------------------
    |     2      | Feed 1     |  03/28/2012       |  www.be.com  |
    --------------------------------------------------------------
    |     3      | Feed 2     |  03/28/2012       |  www.hi.com  |
    --------------------------------------------------------------
    |     4      | Feed 3     |  03/28/2012       |  www.ex.com  |
    --------------------------------------------------------------
    

    Visualization: Feed Resources table

    ------------------------------------------------------------------------------------------------
    |   rec_id   |  feed_id   |     content                                         |    type      |
    ------------------------------------------------------------------------------------------------
    |     1      |      1     | 'hello world!                                       |    text      |
    --------------------------------------------------------------------------------------
    |     2      |      3     | 'http://me.com/my-image                             |     img      |
    ------------------------------------------------------------------------------------------------
    |     3      |      2     |{\'title\':\'VIDEO\',\'url\':\'http://me.com/1.mov\'}|     vid      |
    ------------------------------------------------------------------------------------------------
    |     4      |      1     | 'Wow that was easy!'                                |     text     |
    ------------------------------------------------------------------------------------------------
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 tables - first table holds all unique data (columns: title, artist,
I have this table: id feed_id ... Let's say that I have 500 rows
I have a RSS feed i need to display in a table (its clothes
I have a news feed where items in the feed are created from JSON
Let's say I have 2 tables, Message and Product. Whenever a user post a
I am using Ember.js to create a table from a json feed. I have
I have a set of tables that feed into a historical reports. It's taking
I'm trying to make a News Feed and I'm stuck. Let's say I have
I have an RSS feed reader with a table view. When I run my
I have one table with USERS and another table with RSS FEED URLS. Both

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.