Archive for July, 2007
Primary sources
by maggie on Jul.19, 2007, under entry
While there are many Oracle-related blogs, articles, updates and random musings available on the Interweb, I keep coming back and back again to three sources.
1. Oracle Docs – everything you ever needed to know about Oracle is here. And by everything, I do truly mean everything. This is a very powerful tool, but great in size as well and as such, sometimes difficult to sift through.
2. Ask Tom – Tom Kyte has been using Oracle since 1988 and has been working for Oracle since 1993. This site is where you can ask Tom to provide answers to common questions and solutions to common problems you may encounter as a database developer. It is basically a place to turn the theory of Oracle Docs into practice.
3.
The Art of SQL by Stephane Faroult with Peter Robson. Oracle documentation teaches you the skills to interact with Oracle and Tom Kyte teaches you how to interact with it wisely. This book takes the knowledge and skills you already have and makes you consider them in situations you encounter in real life.
Writing queries is not only about getting the data that you need. It is also about getting ONLY the data you need, making sure the data can be returned to you fast and that you can do so regardless of how large is the set of data you are querying. (And many others things – read the book to find out more!)
It is written beautifully and sometimes you will find yourself shamelessly using quotes from it, such as:
“denormalization advocates often suggest it at an early stage in the hunt for “performance” – and in fact often at a point in the development cycle when better design (or learning how to use joins) is still an option.”
How to (and how not to) pass an array from PHP to the database
by maggie on Jul.15, 2007, under entry
It would be really useful to have an easy way to pass arrays as bound parameters to queries or procedures from PHP. This would be especially useful if you’re letting Oracle handle most of your data manipulating (as you should).
One example I see time and time again about how to (mis)manage array functionality in PHP’s interaction with the database is the simple “insert more than one record” problem:
$userId = 'some user ID';
foreach($toys as $toy) {
$query = "insert into user_toy (user_id, toy_id) values (:user_id, :toy_id)";
$stmt = $dbh->prepare($query);
$stmt->bindParam(':user_id', $userId);
$stmt->bindParam(':toy_id', $toy['id']);
$stmt->execute();
}
Now let’s talk about what’s wrong with this implementation and how to fix it.
On the bandwagon
by maggie on Jul.04, 2007, under entry
I was planning on sticking with my Nokia E62. It calls people, it stores my address book, it can ssh. What more could you want from a phone? I thought having a pretty decent phone would make me immune from the iPhone madness. And it did – unfortunately only for approximately 8 hours of my husband having one and showing it off all day. By 8pm on Saturday, my patience and self-control were gone and I got one, too.
So far it’s pretty awesome. The beautiful thing is that there is only one button. I call it the panic button – you press it when you don’t know what to do!
Here are some downsides:
- no ssh (I have never been able to get away from pine for e-mail, so not being able to ssh into the machine with my mail is kind of sucky.)
- the camera should take videos as well
- not able to turn off the text auto-correct. While automatic typo fixing might be great in 95% of the case, it doesn’t work so well when you’re typing in a language that’s not English. Words such as “z” and “w” are real words in Polish and they really shouldn’t be auto-corrected into “a” all the time
- no visible file system – how files (e.g. photos) are stored is kind of auto-magical. It’d be nice to see more.
The upsides definitely outweigh the downsides, though. It’s as easy to use as everyone claims. Plus, there’s no doubt that most of the issues I have with this phone will be fixed in upcoming software and firmware updates. Hooray!
Yay, gadgets!
Going to Atlanta (via php|works)!
by maggie on Jul.02, 2007, under entry
Two of my proposals were accepted to the php|works 2007 conference! w00t!
The talks that were accepted were:
You Don’t Need a DBA or What Every PHP Developer Should Know about Database Development
No amount of optimizing can be a substitute for proper design. This talk will focus on good practices when designing a database, ranging from learning how to preserve referential integrity, through proper indexing to optimizing techniques such as denormalization. This talk is meant for developers who would like to make the jump from writing basic SQL queries to more advanced database tasks.
How to Optimize a Database Query
Through a series of examples, this talk will explore how a database query can be optimized for the specific task it is meant to perform. Common themes when optimizing queries: learning what kind of data to expect, assessing your needs, finding the balance between not enough and too many indexes, and utilizing alternate solutions such as denormalization. As the sample queries are dissected to make them better and faster, I will use Oracle’s EXPLAIN PLAN to illustrate how the database is attempting to retrieve data.
Now I gotta go practice public speaking…