[Developers] Query Timeout

Alexander Marks al at metaweb.com
Wed Oct 29 14:35:19 UTC 2008


Counting very large sets will time out. There are two solutions. One is to use estimate-count, which will give you something roughly correct very quickly:

  {
    "type":"/music/artist",
    "return":"estimate-count"
  }

The other, if you want an exact count, is to use cursors and a large page size, like this:

  q = {
    "type":"/music/artist",
    "return":"count",
    "limit":10000
  }
  count = 0
  for r in fb.readall(q):
    count += r["result"]

Al

----- Original Message -----
From: "Kendra Kuhl" <kendra.kuhl at juggle.com>
To: "For discussions about MQL, Freebase API and apps built on Freebase" <developers at freebase.com>
Sent: Wednesday, October 29, 2008 7:21:21 AM GMT -08:00 US/Canada Pacific
Subject: [Developers] Query Timeout





I’m attempting to execute this query: 

{ 

"return" : "count", 

"type" : "/music/artist" 

} 



I realize that there are a lot of topics out there with this type, but why would returning a count timeout? Is there a way around this? 



Thanks, 



Kendra 
_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers


More information about the Developers mailing list