this post was submitted on 18 Jul 2023
64 points (95.7% liked)

Lemmy

12538 readers
7 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to [email protected].

founded 4 years ago
MODERATORS
 

Hi there, Been running my own little Lemmy instance basically to see how it runs with federation and stuff like that. I have had open (email validation) for the odd person or 2 that might want to use it.

Early this morning (my time 4:43am) I had about 15 new users all at the exact same time registering as users with same structure names (random words) followed by 4 numbers. Being all within 1 minute of each other they are obvious bots.

Going through the UI I have not been able to find a way to remove them. I have since changed my registration policy to make the person fill in an application, captcha, email validation etc. to help stop polluting the ecosystem with bots.

Any help would be appreciated. I am running it all under docker

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

Sure. Triggers are normally a good idea as they make sure that data is consistent. Like when you delete a user, a trigger will run to also decrease the number of users by one. But since they run for every row, they can certainly impact performance. Foreign key checks are also implementet as triggers so if your missing an index and the db has to crawl through huge tables of data for every delete (I suspect this was the cause of slowdown during DELETE), that too will affect performance.

While I don't do it often, here is the superuser command I use in psql to disable the triggers before doing any other commands:

SET session_replication_role TO replica;

This is something postgresq uses internally when applying replication data, as it assumes all the data is correct and valid and don't fire any of the triggers or rules that would normally apply when modifying data. As you can see from the name, this is a session setting. If you quit the db session, everything goes back to normal so no data is changed and you don't run the risk of forgetting to change it back when your done.

If you do want to go back to normal operation during the same session for some reason, this gets you back to the default:

SET session_replication_role TO origin;

And thank you for the helpful post about the bot problem in the first place.