couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "paul jobs" <>
Subject notifications heavy writes - really slow views
Date Sat, 10 Jan 2009 23:01:03 GMT
class Notification(Document):
    unread = BooleanField(default=True)
    activity = TextField()
    appname = TextField()
    image = TextField()
    type = TextField(default='notification')
    fromuser = TextField()
    touser = TextField()
    link = TextField()
    message = TextField()
    created = DateTimeField(
    time =TimeField(
    date = DateField(

def savenotifications(fromuser, tousers, link, message, activity, image,
appname, *args, **kwargs):
    for touser in tousers:
        if fromuser == touser:continue
        notidoc = Notification( fromuser = fromuser,touser=touser,
link=link, message=message, activity=activity, image = image, appname =
    for touser in tousers:
        r=fbcouchdb.view('_view/pop/unread',key=str(touser), count=1)
        for i in r:i

I ever try to prepare the views when some one gets a new notifications by
precalling the view unread

but whenever i do  getnotification it is really slow.. And the page doesnt
open forever. Anyways to make couchdb usable with this db? the situation is
that notifications are constantly inserted into the db all the time as
things happen to the user in real time. is this not a good use case for

    def getnotifications(self, all=False):
            from couchmodel import fbcouchdb
            if not all:
                return [ (, x.value) for x in
ad',key=str(self.uid), count=5) ]
                return [ (, x.value) for x in
fications',key=str(self.uid)) ]

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message