Posts Tagged: tips
While moving around on the net for some MySQL solutions, I stopped at forge.mysql.com, wher I found a lot of tips regarding defferent issues in MySQl. So I thought it would be much helpful for those who are new at MySQL, or are looking for some very important and useful information about MySQL and posted them here with the original source link.
Specific Query Performance Tips
- Use EXPLAIN to profile the query execution plan
- Use Slow Query Log (always have it on!)
- Don’t use DISTINCT when you have or could use GROUP BY
- Insert performance
- Batch INSERT and REPLACE
- Use LOAD DATA instead of INSERT
- LIMIT m,n may not be as fast as it sounds. Learn how to improve it (if possible): http://www.facebook.com/note.php?note_id=206034210932
- Don’t use ORDER BY RAND() if you have > ~2K records
- Use SQL_NO_CACHE when you are SELECTing frequently updated data or large sets of data
- Avoid wildcards at the start of LIKE queries
- Avoid correlated subqueries and in select and where clause (try to avoid in)
- No calculated comparisons — isolate indexed columns
- ORDER BY and LIMIT work best with equalities and covered indexes
- Separate text/blobs from metadata, don’t put text/blobs in results if you don’t need them
- Derived tables (subqueries in the FROM clause) can be useful for retrieving BLOBs without sorting them. (Self-join can speed up a query if 1st part finds the IDs and uses then to fetch the rest)
- ALTER TABLE…ORDER BY can take data sorted chronologically and re-order it by a different field — this can make queries on that field run faster (maybe this goes in indexing?)
- Know when to split a complex query and join smaller ones
- Delete small amounts at a time if you can
- Make similar queries consistent so cache is used
- Have good SQL query standards
- Don’t use deprecated features
- Turning OR on multiple index fields (<5.0) into UNION may speed things up (with LIMIT), after 5.0 the index_merge should pick stuff up.
- Don’t use COUNT * on Innodb tables for every search, do it a few times and/or summary tables, or if you need it for the total # of rows, use SQL_CALC_FOUND_ROWS and SELECT FOUND_ROWS()
- Use INSERT … ON DUPLICATE KEY update (INSERT IGNORE) to avoid having to SELECT
- use groupwise maximum instead of subqueries
- Avoid using IN(…) when selecting on indexed fields, It will kill the performance of SELECT query.
Scaling Performance Tips
- Use benchmarking
- isolate workloads don’t let administrative work interfere with customer performance. (ie backups)
- Debugging sucks, testing rocks!
- As your data grows, indexing may change (cardinality and selectivity change). Structuring may want to change. Make your schema as modular as your code. Make your code able to scale. Plan and embrace change, and get developers to do the same.
Network Performance Tips
- Minimize traffic by fetching only what you need.
- Paging/chunked data retrieval to limit
- Don’t use SELECT *
- Be wary of lots of small quick queries if a longer query can be more efficient
- Use multi_query if appropriate to reduce round-trips
- Use stored procedures to avoid bandwidth wastage
OS Performance Tips
- Use proper data partitions
- For Cluster. Start thinking about Cluster *before* you need them
- Keep the database host as clean as possible. Do you really need a windowing system on that server?
- Utilize the strengths of the OS
- pare down cron scripts
- create a test environment
- source control schema and config files
- for LVM innodb backups, restore to a different instance of MySQL so Innodb can roll forward
- partition appropriately
- partition your database when you have real data — do not assume you know your dataset until you have real data
MySQL Server Overall Tips
- innodb_flush_commit=0 can help slave lag
- Optimize for data types, use consistent data types. Use PROCEDURE ANALYSE() to help determine the smallest data type for your needs.
- use optimistic locking, not pessimistic locking. try to use shared lock, not exclusive lock. share mode vs. FOR UPDATE
- if you can, compress text/blobs
- compress static data
- don’t back up static data as often
- enable and increase the query and buffer caches if appropriate
- config params — http://docs.cellblue.nl/2007/03/17/easy-mysql-performance-tweaks/ is a good reference
- Config variables & tips:
- use one of the supplied config files
- key_buffer, unix cache (leave some RAM free), per-connection variables, innodb memory variables
- be aware of global vs. per-connection variables
- check SHOW STATUS and SHOW VARIABLES (GLOBAL|SESSION in 5.0 and up)
- be aware of swapping esp. with Linux, “swappiness” (bypass OS filecache for innodb data files, innodb_flush_method=O_DIRECT if possible (this is also OS specific))
- defragment tables, rebuild indexes, do table maintenance
- If you use innodb_flush_txn_commit=1, use a battery-backed hardware cache write controller
- more RAM is good so faster disk speed
- use 64-bit architectures
- increase myisam_sort_buffer_size to optimize large inserts (this is a per-connection variable)
- look up memory tuning parameter for on-insert caching
- increase temp table size in a data warehousing environment (default is 32Mb) so it doesn’t write to disk (also constrained by max_heap_table_size, default 16Mb)
- Run in SQL_MODE=STRICT to help identify warnings
- /tmp dir on battery-backed write cache
- consider battery-backed RAM for innodb logfiles
- use –safe-updates for client
- Redundant data is redundant
Storage Engine Performance Tips
- InnoDB ALWAYS keeps the primary key as part of each index, so do not make the primary key very large
- Utilize different storage engines on master/slave ie, if you need fulltext indexing on a table.
- BLACKHOLE engine and replication is much faster than FEDERATED tables for things like logs.
- Know your storage engines and what performs best for your needs, know that different ones exist.
- ie, use MERGE tables ARCHIVE tables for logs
- Archive old data — don’t be a pack-rat! 2 common engines for this are ARCHIVE tables and MERGE tables
- use row-level instead of table-level locking for OLTP workloads
- try out a few schemas and storage engines in your test environment before picking one.
Database Design Performance Tips
- Design sane query schemas. don’t be afraid of table joins, often they are faster than denormalization
- Don’t use boolean flags
- Use Indexes
- Don’t Index Everything
- Do not duplicate indexes
- Do not use large columns in indexes if the ratio of SELECTs:INSERTs is low.
- be careful of redundant columns in an index or across indexes
- Use a clever key and ORDER BY instead of MAX
- Normalize first, and denormalize where appropriate.
- Databases are not spreadsheets, even though Access really really looks like one. Then again, Access isn’t a real database
- use INET_ATON and INET_NTOA for IP addresses, not char or varchar
- 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)
- A NULL data type can take more room to store than NOT NULL
- Choose appropriate character sets & collations — UTF16 will store each character in 2 bytes, whether it needs it or not, latin1 is faster than UTF8.
- Use Triggers wisely
- use min_rows and max_rows to specify approximate data size so space can be pre-allocated and reference points can be calculated.
- Use HASH indexing for indexing across columns with similar data prefixes
- Use myisam_pack_keys for int data
- be able to change your schema without ruining functionality of your code
- segregate tables/databases that benefit from different configuration variables
- Hire a MySQL ™ Certified DBA
- Know that there are many consulting companies out there that can help, as well as MySQL’s Professional Services.
- Read and post to MySQL Planet at http://www.planetmysql.org
- Attend the yearly MySQL Conference and Expo or other conferences with MySQL tracks (link to the conference here)
- Support your local User Group (link to forge page w/user groups here)
If recruiting is considered the lifeblood of an organization, then training must certainly be its pulse. Experienced salespeople are often reluctant to take time away from their busy schedule for training and as a result, over time, become less productive. It is only natural to expect commission-based salespeople to resist any activity that takes them away from their customers. Award winning sales managers place a high premium on training and purposefully design their training programs to be timely, relevant, realistic, and reoccurring.There is absolutely no substitute for a well-trained and highly motivated sales force! In his best selling book, The 7 Habits of Highly Effective People, Dr. Stephen Covey makes a strong case for the fundamental importance of training, or as he calls it, “sharpening the saw.” In addition to skill development, Dr. Covey points out that time allocated for training also provides an opportunity for much needed personal reflection and renewal. Progress and growth are virtually impossible in an environment void of assessment and training.
Timing is everything. It is important to operate from a written training program and schedule training well in advance. Due to the damaging ripple affect on appointment calendars, training must be scheduled at least 30-days in advance and short notice changes should be avoided. Planning ahead not only helps minimize scheduling conflicts, but it also provides opportunity for training preparation and promotion. Attendees are typically more receptive and inclined to participate when they have been given sufficient time to plan and prepare for the training.
For training to be perceived as relevant and beneficial by the sales force, they must be given the opportunity to contribute to topic selection. An excellent way to elicit input and establish training priorities is through the use of a self-administered, skills assessment survey. A well-designed survey will evaluate skill expertise over a wide array of categories such as administrative tasks, product knowledge, and sales proficiency. For example, it is quite common for a low producer to rate themselves high in product knowledge and low in sales related categories. The skills assessment survey not only provides a good benchmark of an organization’s current overall training level, but it also serves to identify potential peer trainers as well. With the appropriate person, peer training can be extremely effective and therefore should be encouraged.
As they say in the military, train like you plan to fight! Obviously, the more realistic and thought provoking the training, the greater its impact. Build value into your training sessions by finding ways to inject realism. For example, if you are role-playing phone scripts, it’s preferable to separate the participants and conduct the training over the phone vs. across the table. Due to the lack of visual cues, this approach closely mimics the real experience. If a picture is worth a thousand words, then videotaping a role-play session speaks volumes. Videotaped training sessions don’t lie and therefore, provide an excellent opportunity for self-critique. A videotape provides meticulous feedback on body language and sales techniques that otherwise may go unnoticed.
Designing a successful training program is limited only by your creativity. With a little effort and imagination, you can develop a world-class training program that will excite your sales team and keep them coming back for more!
Source: John Boe
Probably, there is no human being in the world who doesn’t have any hobby or interest of his/her own. Some one may love and have a large collection of books, music, and movies or may be sports fanatic or enjoy traveling. Some one may also love gardening or having pets. Doing things we love to do, reduces stress and helps us to temporarily forget our every day problems and troubles, in some cases it may inspire us to find a solution to a problem. But not everyone has a hobby that makes money for him/her except if you love your job.
Earning money with a hobby you love to do could earn you an extra income, with practice and experience it could allow you to quit your day job. That is why many of us today go online to start a business; their reasons are either to supplement their income or to gradually replace their offline income from their job. A great way to start making money online is through affiliate marketing.
Affiliate marketing is sharing revenue between an online merchant and one or more affiliates. The affiliate refers new customers to the online merchant and is paid a commission for either the new referral or sales generated. There are several advantages to affiliate marketing, mainly you don’t need to generate or stock an inventory of products, no need to create an online e-store, and you never have to worry about keeping a customer happy, the merchant takes care of it all.
Now, for sure you want to be an affiliate marketer with all the benefits an affiliate could get. But, do you have what it takes to be an affiliate marketer? To properly begin in affiliate marketing, you have to decide what area or areas you’re interested in. What products do you know the most and which products you could do the best job of selling? Once you discover your specialty; perseverance, patience, and determination comes next. These qualities should be possessed in order to be a good affiliate marketer.
A lot of online affiliate marketers become impatient and fail. You have to know your strengths and weaknesses, what things are you good at and what are your abilities and capabilities related to your chosen niche. The most important thing is you have to have a strong desire and will to succeed in affiliate marketing.
To be an affiliate marketer is not an easy task. You have to learn the techniques of marketing your product or service. There are many marketers out there promoting their ways of marketing, one should be cautious in attempting to jump on each technique. To be a successful affiliate marketer, you should learn how to listen and to be taught because in life we need to learn skills to get by.
An affiliate marketer should know how to effectively market their product; an effective marketing technique will get thousands of visitors to view their product which equates to more sales. Creating and publishing your own website will create a bigger chance of making money online faster. Avoiding the same mistakes of other affiliates is advised; many are just in it for a quick buck and fail to build a long term business. It’s important to understand that you’re building a long term business. It is essential to focus on what will makes you several sales each day and not the few dollars you’ll make in one sale.
It is also better to have knowledge on how to upsell your visitors for expensive services. This will distinguish you as an expert to the field which will allow you to sell more products and make more money. There are some people thinks that just by having affiliate links on their website will bring them good profits. It is true that some affiliates do make good money this way, but many still believe that it is more effective to use a strong marketing campaign in order to be successful. Affiliate marketers who treat their online visitors or customers as friends are more successful than those who don’t. Establish a relationship with customers and especially with the visitors to your website. Building a good business relationship with customers will bring that customer back again and again.
You should also be creative. The real key to being successful with affiliate marketing is to develop a good content based website and weave your affiliate links into all your content. Providing your visitors with good, quality, and updated content will keep them coming back to your site. Affiliate marketing can be a long term profitable and successful business.
By Michael Conant