What is synchronous notification?Up to now, in order to get notifications from postgresql, Npgsql clients would need to call empty commands. If application didn't do that, only on next NpgsqlCommand.Execute* call notification would be delivered.Now with synchronous notification, client applications are notified as soon as message arrives, hence the name synchronous notification.

On current code, it is disabled by default. To enable it, you have to put syncnotification=true in your connection string.

How it works?

When you enable synchronous notification, Npgsql will create another thread to check is data arrived in socket. To do that, it uses Socket.Poll method. When Npgsql is idle, this thread is running. It is stopped as soon as any NpgsqlCommand.Execute* method is called and resumed when this call returns.

Side effects:

Because of synchronization of threads, there is performance drop when using synchronous notification. So, if you want max performance, don't use it. Synchronous notification is more valuable on desktop applications where they have more idle cycles and need more "real time" notifications.