Jump to content

table with too many relationships

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
hi people,
while i was working on a database i found out that theres a table that takes too much relationships both 1-m and m-1(about 8 potential relations and counting), and it will probably get accessed alot because it will be used in lots of queries, so i have some questions that i need to get answers for them:
1. does the number of relations affect the performance of the database server(mysql)?
2. if yes, how to fix it?
3. its used in searching alot, so does copying the fields in another temporary table that gets updated every day helps in anything??



and yeah:can a primary key be just an int?
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#2
Stu_328

Stu_328

    Learning Programmer

  • Members
  • PipPipPip
  • 92 posts
1. Yes, if your searching those tables too.
2. Denormailisation if possible
3. What about you archive data that doesnt get searched a lot into an archive table. Say data older than a month or something? Then, searches on data less than a month old will be performed quicker.

4. Yes it can, but you'll have to make sure its unique manually when adding tuples to the table.

HTH

#3
amrosama

amrosama

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 8,674 posts
+rep
thnx alot for your post
about no.4: doesnt the auto_increment work fine?
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#4
Stu_328

Stu_328

    Learning Programmer

  • Members
  • PipPipPip
  • 92 posts
Yes, but it won't be on by default I don't think. You'll have to set it when you create the table. If you set the column to primary key however, it'll do all that by itself.

#5
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,298 posts
a primary key can not be only auto_increment, as that is just an addition to the field information. the primary key field still neds to have a datatype, and int works just fine.

but usually, you design the primary key to be exactly "int auto_increment"