I'd suggest wrapping it into a function that queries based on key using get_col to select just the meta values, you'll get a nice flat array of data returned(you'll not get that with get_results unfortunately).
function get_meta_values( $key = '', $type = 'post', $status = 'publish' ) {
global $wpdb;
if( empty( $key ) )
return;
$r = $wpdb->get_col( $wpdb->prepare( "
SELECT pm.meta_value FROM {$wpdb->postmeta} pm
LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id
WHERE pm.meta_key = '%s'
AND p.post_status = '%s'
AND p.post_type = '%s'
", $key, $status, $type ) );
return $r;
}
Assuming you're querying for meta values associated with posts that are published selecting all the meta values is a simple case of..
$my_var = get_meta_values( 'YOURKEY' );
Or if you want to see a quick print out of the results(without needing to loop over the array returned)..
echo implode( '<br />', get_meta_values( 'YOURKEY' ));
The above query should be pretty light, and if you want to do counts, you can work that out looping over the returned data, eg..
$my_var = get_meta_values( 'YOURKEY' );
if( !empty( $my_var ) ) {
$meta_counts = array();
foreach( $my_var as $meta_value )
$meta_counts[$meta_value] = ( isset( $meta_counts[$meta_value] ) ) ? $meta_counts[$meta_value] + 1 : 1;
}
$meta_counts would then hold an array of counts, the key is the meta value, the value is the count for that value, ie..
Array(
[some_meta_value] => 10
[some_other_value] => 2
)
I hope that helps.. :)