3 ms·
create table log (dt timestamp not null primary key, msg text not null) is usually all you need to start sifting through the haystack. Problem with this approa
by gabereiser 3y ago
create table log (dt timestamp not null primary key, msg text not null)
is usually all you need to start sifting through the haystack. Problem with this approach is if you aren't diligent, you'll end up killing you app AND you're db.
- deleted 3y ago[deleted]
- sgarland 3y agoYou can’t use log timestamps as a PK; you’ll run into non-unique entries nearly immediately.
- gabereiser 3y agoWe already established that log sifting at scale isn’t productive nor does it work for reasons outlined in the article. This was just an answer to how to do it in a smaller scale. Yeah, primary key is going to give you problems, a simple index shouldn’t but the issue is this, logs are not event sources - or shouldn’t be. The only time you should be looking is when your looking for stack trace and even then there’s better options like sentry.