Database Reference
In-Depth Information
Now we have 100,000 users with 0 to 10 friends
each, for a total of 501,900 friends. hannu=#
SELECT count(*) FROM (SELECT
username,unnest(friend_list) FROM user_info) a;
-[ RECORD 1 ]-
count | 501900
Now, let's send each of the friends a message:
hannu=# SELECT
send_message(username,unnest(friend_list),'hello
friend!') FROM user_info;
Look how fast we can retrieve the messages:
hannu=# select get_new_messages('50000');
get_new_messages
----------------------------------------------------------
(200,"hello friend!",49992,"2012-01-09
02:23:28.470979")
(200,"hello friend!",49994,"2012-01-09
02:23:28.470979")
(200,"hello friend!",49995,"2012-01-09
02:23:28.470979")
(200,"hello friend!",49996,"2012-01-09
02:23:28.470979")
(200,"hello friend!",49997,"2012-01-09
02:23:28.470979")
(200,"hello friend!",49999,"2012-01-09
02:23:28.470979")
(200,"hello friend!",50000,"2012-01-09
02:23:28.470979")
Search WWH ::




Custom Search