1

The following table is part of my project. I'm really strict about field types and store engines. I've read a lot of questions from this site, but I think there are a lot to do in the first step. Is there anything wrong with below fields and/or their relationship? Thanks in advance.

https://i.stack.imgur.com/AT1Ie.jpg

3
  • MyISAM engine does not support foreign keys. I guess you must be using InnoDB table type. small integer may not be the right datatype. Consider INT. The logical flow seems to be OK.
    – shantanuo
    Dec 15, 2011 at 14:22
  • tnx, the problem with InnoDB is that the store engine does the select queries slower than MyISAM (ofcourse not in all cases), and select is really important for me. I have a lot of select statements.
    – Alireza
    Dec 15, 2011 at 15:11
  • "InnoDB selects are slower than MyISAM" and alligators live in NY sewers: bigsiteofamazingfacts.com/… Dec 16, 2011 at 13:42

1 Answer 1

1

Based on the comments to your question, I would strongly recommend using InnoDB since it is ACID complaint and supports your foreign key layout.

When it comes to using InnoDB:

As for the log table you have that uses the ARCHIVE storage engine, keep in mind

  • ARCHIVE storage engine has no indexes
  • Only INSERTs and SELECTs allowed
  • All SELECTs are full table scans every time

As for SELECTs, you must tune the SELECTs to take proper advantage of table indexes. Otherwise, add the appropriate indexes to the tables.

1
  • hi, I always learn new things from your posts, tnx. actually Archive SE support one and only one index. I can use LIMIT to prevent full table scan. If I'm wrong please correct me. It is appreciated.
    – Alireza
    Dec 16, 2011 at 3:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.