Wordpress: Get all term ids by taxonomy name

I was using the Wordpress function get_terms( 'tax_name' ) to create a list with all terms. But unfortunately it does not work. Sometimes there was an empty array, an array with an error inside or an incomplete array.  Studying the Wordpress Codex [1], I found out how to get all the terms:
$terms = get_terms( 'tax_name', array('get' => 'all', 'fields' => 'ids') )
foreach ( $terms as $termID ) {
// magic here please ...
}

[1] http://codex.wordpress.org/Function_Reference/get_terms