Stupid monitoring trick: Watch mysql queries fly

Put this somewhere in your ~/bin:

watch 'echo "show processlist" | mysql -u whateveruser --password=mypassword | grep -v "show processlist" '

Now run it and you will have a poor man’s monitor, kind of like top but for MySQL. That coupled with screen (or multiple terminals) may give you some quick and easy piece of mind.

This should give you *a lot* of monitoring automation ideas. It should be easy to put together a shell script that puts it all in a little “important things panel” to use watch on. Sometimes that’s all you need.

Oracle tuning: Using Hints

Every once in a while you will get a query that no matter what you try, it doesn’t use the indices. This is typically because the cost-based optimizer decides that an approach that is slower has a total cost that is lower than using the index and making it faster.

To solve this, you would use a hint. You can find an article on how to do this on dbasupport. But the basics are: Continue reading “Oracle tuning: Using Hints”