Jump to content

Top 20 boas práticas em MySQL


Hipnoted
 Share

Recommended Posts

1. Optimize Your Queries For the Query Cache

2. EXPLAIN Your SELECT Queries

3. LIMIT 1 When Getting a Unique Row

4. Index the Search Fields

5. Index and Use Same Column Types for Joins

6. Do Not ORDER BY RAND()

7. Avoid SELECT *

8. Almost Always Have an id Field

9. Use ENUM over VARCHAR

10. Get Suggestions with PROCEDURE ANALYSE()

11. Use NOT NULL If You Can

12. Prepared Statements

13. Unbuffered Queries

14. Store IP Addresses as UNSIGNED INT

15. Fixed-length (Static) Tables are Faster

16. Vertical Partitioning

17. Split the Big DELETE or INSERT Queries

18. Smaller Columns Are Faster

19. Choose the Right Storage Engine

20. Use an Object Relational Mapper

http://net.tutsplus.com/tutorials/other/top-20-mysql-best-practices/

"Nunca discutas com um idiota. Eles arrastam-te até ao seu nível e depois ganham-te em experiência"

Link to comment
Share on other sites

Não concordo com a ultima! Nem sequer é uma prática relacionada com o MySQL, mas sim com a parte aplicacional...

Se por exemplo se necessitar de muita performance, ou se as interacções com a BD e o schema forem simples, podes crer que não vão utilizar o ORM.

A prática numero 17, também depende de muita coisa. Se eu fizer o insert de muitos registos ao mesmo tempo, esse insert vai ser muito mais rápido que um insert por cada registo. E o exemplo usado para justificar o 17 é um caso particular, não vou discutir se é válido, porque a utilização de um caso particular para justificar o geral é um erro de lógica e por isso é tempo perdido.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.