2

I am building a game site with a lot of queries. For optimisation what is best. handeling the data with a lot of tables and relations or fewer tables but with many fields?

I would think, especially regarding to inserts and updates that fewer fields with many fields would be better than many tables. That would give more queries or???

I'm trying to figure out what is best course I am experiencing high load on my server at the evenings when I have a lot of users...

3
  • 1
    What's best?! Profiling. Commented Jan 28, 2013 at 22:06
  • You'll need to give some more info on your data model. General rule is to Normalise first then look at optimising. Commented Jan 28, 2013 at 22:07
  • Dont optimize before developing. Commented Jan 28, 2013 at 22:09

2 Answers 2

2

Start off with the database normalized. Ensure that you have the appropriate indexes for the queries/updates/inserts that you are doing. Use optimize table periodically.

If you are still encountering problems do some profiling to find out where the performance is insufficient. Then consider either denormalizing or perhaps rewriting the queries.

In addition make sure that the system cannot have deadlocks. That really messes up performance.

Sign up to request clarification or add additional context in comments.

3 Comments

What do you mean about deadlocks?
if you put with (nolock) in all of your sql queries you can avoid locking. ie: select * from table with (nolock)
@Mansa - See the link above. There are techniques to prevent them, avoid them and/or handle them. Also you can prevent locking as Chris has pointed out.
1

i don't think the number of columns effects anything, really. it's all about how well you've indexed the columns. if you do more updates then selects on a particular field, you might want to drop the index if you have one.

not really an answer, just something i've noticed.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.