How do I find which file contains a function? How do I find where a Drupal function is defined? For example, in which Drupal file is db_query() defined?
You can find it at includes/database/database.inc, line 2342.

Your editor may be providing a similar feature like the one implemented in Zend studio: When you press control while you click on the function name, it will take you to the file containing the implementation of that function.