i have a similiar problem. my YQL php script takes really long to complete. on my home testing server it takes ages and on my live webspace the script times out and my website is not displayed any more because the whole wordpress process hangs.
here is my script that i use to fetch my videos and pic from vimeo and flickr:
CODEBOX
/* Vimeo */
$YQLquery = 'select video.id, video.url, video.title, video.description, video.width, video.height, video.thumbnail_small, video.thumbnail_large, video.thumbnail_medium, video.tags from vimeo.user.videos where username="user1282871";';
/* Flickr search by user id */
$YQLquery .= 'select id, farm, server, secret, title, description, tags, dateuploaded from flickr.photos.info(1000) where photo_id in(select id from flickr.photos.search(1000) where user_id="49412513@N02") | sort(field="dateuploaded",descending="false")';
/* The YQL web service root with JSON as the output */
$YQLroot = 'http://query.yahooapis.com/v1/public/yql?format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env';
/* Assemble the query */
$YQLquery = "select * from yql.query.multi where queries='".$YQLquery."'";
$YQLurl = $YQLroot . '&q=' . urlencode($YQLquery);
/* Do the curl call (access the data just like a browser would) */
$YQLch = curl_init();
curl_setopt($YQLch, CURLOPT_URL, $YQLurl);
curl_setopt($YQLch, CURLOPT_RETURNTRANSFER, 1);
$YQLoutput = curl_exec($YQLch);
curl_close($YQLch);
$YQLdata = json_decode($YQLoutput);
$YQLresults = $YQLdata->query->results->results;
any suggestions?