We're doing some research and to get a lot of current data we're mining the twitter spritzer json stream. I've written some ruby code leveraging the eventmachine http request gem to pulling the info, parse it, and passing to the DB and all that works great, but the DB is starting to create a backup.
Before inserting new user records, we're doing a select to make sure that we haven't seen anything from the user before, but as the DB has grown this request (and the subsequent update if it does exist) has gotten to take a long time and I was looking for some advice on how to better scale it. Right now our DB is somewhere around 20m entries in the particular table, and adding somewhere around 10k entries per hour (though this will drop as we begin to get less and less unique entries).
I have little DBA experience (however I'd designed/implemented a number of schemas), are these numbers normal for having performance degrade?
As far as making things better I've read some things about splitting up the large logical table into a bunch of smaller tables, but since our key (the user id) is basically random postgres would still be having to load up each smaller table in memory for each individual query.
Another approach could be inserting into a "scratch" table and syncing up with the main table in another process every few hours/days?
Before inserting new user records, we're doing a select to make sure that we haven't seen anything from the user before, but as the DB has grown this request (and the subsequent update if it does exist) has gotten to take a long time and I was looking for some advice on how to better scale it. Right now our DB is somewhere around 20m entries in the particular table, and adding somewhere around 10k entries per hour (though this will drop as we begin to get less and less unique entries).
I have little DBA experience (however I'd designed/implemented a number of schemas), are these numbers normal for having performance degrade?
As far as making things better I've read some things about splitting up the large logical table into a bunch of smaller tables, but since our key (the user id) is basically random postgres would still be having to load up each smaller table in memory for each individual query.
Another approach could be inserting into a "scratch" table and syncing up with the main table in another process every few hours/days?