Imagine if you have 100 records, 10 columns.Your working with a database of your clients details, and need to select their name, phone number and address. You’d write: SELECT * FROM clients; What’s up with that? Nothing. You’d then simply reference the columns you want later. Wrong! That single line of code is highly inefficient. It’s fetching 1000 pieces of information from the database! However, if you wrote this: SELECT name, phone, address FROM clients; You’ve now cut down to only 300 calls. That’s a 700 saving. Probably not noticeable on a database that size, but you should always think about what your code is actually doing. That way, you can code efficiently in the first place, and make your app much more scalable. Super Tip: In some cases, you can cut down to simply 3, by using a well thought out ‘WHERE’ clause.
Wednesday, 17 April 2013
Title: 1- OPTIMIZE YOUR CODE
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment