Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8401451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:48:36+00:00 2026-06-09T21:48:36+00:00

I am trying to grab the latest links shared by a user’s facebook friends

  • 0

I am trying to grab the latest links shared by a user’s facebook friends in the last few days. Let’s say in the last 7 days:

Using FQL, I am able to grab this for up to 20 friends at a time:

$fql = "SELECT link_id, owner, created_time, title, summary, url, image_urls FROM link WHERE owner IN (select uid2 from friend where uid1 = me() LIMIT 20) AND created_time >= $_7ago";

If I set the friend count limit from 20 to something higher, the query crashes. My current solution is to repeat this query, breaking down (say) 1000 friends into groups of 20s inside a loop. This actually worked but it takes more than five minutes to run.

I’ve also tried multi-querying this way (and the speed hasn’t increased):

"links":"select uid2 from friend where uid1 = me() LIMIT 20",
"stats":"SELECT owner, owner_comment, title, summary, url, image_urls FROM link WHERE owner IN (select uid2 from #links) AND created_time  >= \"' . $_7ago . '\""

Is there a faster alternative / solution?

http://www.pixable.com/ <- manages to pull monthly photos shared by friends in less than 3 seconds

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:48:38+00:00Added an answer on June 9, 2026 at 9:48 pm

    Multiqueries can be used to fire multiple non-related queries too. First get the friend uids, then create the individual queries by sharding the uids into chunks and fire off all the queries at once. In js sdk this would look like:

    FB.api( {
        method: 'fql.multiquery',
        queries: [
                'SELECT owner, owner_comment, title, summary, url, image_urls FROM link WHERE owner IN ('+chunk0+') AND created_time  >= '+time,
                'SELECT owner, owner_comment, title, summary, url, image_urls FROM link WHERE owner IN ('+chunk1+') AND created_time  >= '+time,
                'SELECT owner, owner_comment, title, summary, url, image_urls FROM link WHERE owner IN ('+chunk2+') AND created_time  >= '+time
         ]}, function(results) {
         console.log(results); // array with the individual query results
             var query_results = null;
             var row = null;
             for (var i = 0, l = results.length; i < l; ++i) {
                 var query_results = results[i];
                 for (var i2 = 0, l2 = query_results.fql_result_set.length; i2<l2; ++i2) {
                     row = query_results.fql_result_set[i2];
                     console.log(row);
                     // at this point row variable contains individual rows from the link table
                     // with the selected fields
                     console.log(row.owner, row.title); // should log something useful
                 }
             }
         }
    );
    

    The documentations states that this should be faster than using the batch api interface:

    This method also has better performance than running a series of fql.query calls with batch.run.

    In firebug the first console.log(results) should show something similar to this (actual id’s are removed/truncated for space constrains):
    Firebug console output for results

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to grab a user job notes but am not sure what
I'm using Netbeans and I want to grab the latest hibernate artifact from the
I am trying to grab numeric value(ie 105) using preg_match from html page, please
I'm trying to grab all the links and their content from a text, but
I'm trying to grab the latest ID from a duplicate record within my table,
Im trying to grab the entire DOM from a page using document.getElementsByTagName('html')[0].innerHTML but I
I am trying to grab images using MIL library and I wanted to render
I'm trying to grab the number of days left until an account expires so
I'm trying to grab some JSON data from a web service using JSON.Net. The
Im trying to grab the ids of the images using rails, pass those ids

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.