Contents ...
udn網路城邦
Database Design Performance Tips
2010/05/12 03:55
瀏覽760
迴響0
推薦1
引用0

Database Design Performance Tips:

  1. Design sane query schemas. don't be afraid of table joins, often they are faster than denormalization
  2. Don't use boolean flags
  3. Use Indexes
  4. Don't Index Everything
  5. Do not duplicate indexes
  6. Do not use large columns in indexes if the ratio of SELECTs:INSERTs is low.
  7. be careful of redundant columns in an index or across indexes
  8. Use a clever key and ORDER BY instead of MAX
  9. Normalize first, and denormalize where appropriate.
  10. Databases are not spreadsheets, even though Access really really looks like one. Then again, Access isn't a real database
  11. use INET_ATON and INET_NTOA for IP addresses, not char or varchar
  12. make it a habit to REVERSE() email addresses, so you can easily search domains (this will help avoid wildcards at the start of LIKE queries if you want to find everyone whose e-mail is in a certain domain)
  13. A NULL data type can take more room to store than NOT NULL
  14. Choose appropriate character sets & collations -- UTF16 will store each character in 2 bytes, whether it needs it or not, latin1 is faster than UTF8.
  15. Use Triggers wisely
  16. use min_rows and max_rows to specify approximate data size so space can be pre-allocated and reference points can be calculated.
  17. Use HASH indexing for indexing across columns with similar data prefixes
  18. Use myisam_pack_keys for int data
  19. be able to change your schema without ruining functionality of your code
  20. segregate tables/databases that benefit from different configuration variables

REF:http://blog.jaric.tw/2009/04/08/top-10-sql-performancetips/

有誰推薦more
全站分類:知識學習 隨堂筆記
自訂分類:DBMS
上一則: Specific Query Performance Tips
下一則: set define off
發表迴響

會員登入