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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:48:46+00:00 2026-05-13T19:48:46+00:00

I have a question about relationships between two tables. Let’s say we have a

  • 0

I have a question about relationships between two tables.

Let’s say we have a table users, and links.

users
+++++++++
id name
1  name1
2  name2
3  name3
+++++++++

links
+++++++++
id link
1  link1
2  link1
3  link1
+++++++++

Now the normal way to link these two is with a name_links table.
For example:

name_links
++++++++++++
uid  lid
1    1
1    3
2    3
2    1
2    2
3    2
++++++++++++

Now i was wondering if it is a good idea to make a table like this

name_links
++++++++++++
uid  lid
1    1,3
2    1,2,3
3    2
++++++++++++

Pros and cons i can think of are:

pros1:

You will always search on indexes, faster queries
example select where uid=1 and then select links 1,3. Both are indexes so it will be a fast load.

If you have 1000 users, and they each have 20 links, this means you have to go trough 20.000 records to get all the links(i think, not sure of this). Using this method you only take one index and you are done.

cons1:

You will have to update the name_links table more frequently, read, edit, and write
example user 2 deletes link2 the method will be:
+ get the string of user 1
+ remove the number from the string
+ insert the new string

Everything here is done on an index, so i assume it will be fast.

cons2:

Another con is when you delete link 2, you have to go trough all the strings, but lets say this is not as much of a problem, as this will not happen often.

This is what i can come up with so far, and I am at the point of my project where i have to decide with which to go.

I would love to have some advice on which method to choose. Do i have my pros and cons right? Are there things I am not taking in considering. Any help on this topic will be highly appreciated.

Thank you guys!

  • 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-13T19:48:47+00:00Added an answer on May 13, 2026 at 7:48 pm

    Denormalized solution has these drawbacks:

    • You cannot efficiently join the names and the links (FIND_IN_SET is not sargable)

    • You cannot enforce referential integrity using FOREIGN KEYs (in InnoDB)

    • Deleting and adding a name-link relationship is more complex

    If you never search for names given a link and the links are few in number, you may possibly benefit by getting rid of an extra join.

    You should make sure that the performance benefit is real, you really need it and you are aware of the complications of maintaining a denormalized table.

    If the links are fixed, you can consider using a native SET datatype instead.

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

Sidebar

Related Questions

I have a Dataset that contains tables from a university database, two(actually more) of
Originally I had two tables in my DB, [Property] and [Employee]. Each employee can
I'm brand new to SQL Server 2008, and have some newbie questions about the
I have a function which takes two arrays containing the tokens/words of two texts
I'm trying to learn Django and I would like feedback from anyone who has
me and my colleagues are developing a website with similar idea as Stackoverflow, but
I was going though problems on graph theory posted by Prof. Ericksson from my
I'm working in a C# project and we are , in order to get
I will soon be beginning work on a project that (from the spec) reminds

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.