3

how to find fql result count?

skaffman
  • 398,947
  • 96
  • 818
  • 769
user341879
  • 87
  • 1
  • 2
  • 5

2 Answers2

12

FQL doesn't support a COUNT function. Get the results, and just enumerate them.

See here: http://blogs.x2line.com/al/archive/2007/10/07/3287.aspx

David M
  • 71,481
  • 13
  • 158
  • 186
  • can you provide an example of how to enumerate them? – user341879 May 15 '10 at 20:21
  • Depends on your programming language - you do it there once you've retrieved the results using FQL. – David M May 15 '10 at 20:35
  • 5
    It is really a pity that FQL does not support the COUNT function. Imagine how much bandwidth it would save if we just needed the count. Instead we have to get one column of data for all the rows and then decide the count. If this FQL result set is going to span multiple pages, we will never get the real count. Such simple basics neglected. – Deepak G M Jul 02 '12 at 10:23
2

I think it's a decision taken by design. It would be potentially very expensive to allow COUNT over huge tables like Facebook ones. I've seen they have tables to store specific counts so you can query them already calculated.

Hernan Veiras
  • 146
  • 1
  • 4
  • 1
    Absolutely ! I guess its not as easy as "SELECT COUNT(..." ^^ FB data base must be partionned over lot of servers and a count operation means browse everything etc.... But they should cache this value to save BP etc... true – Thomas Decaux May 07 '13 at 10:20