April 26, 2024, 5:48 p.m. | Dmitry Romanoff

DEV Community dev.to

This SQL query targets a PostgreSQL database and performs a join between two system views, pg_stat_ssl, and pg_stat_activity, using the process identifier (pid) as the join condition. The purpose of the query is to extract detailed information about database connections that are not using SSL (Secure Sockets Layer) encryption.



SELECT usename, datname, ssl, client_addr, query 
FROM pg_stat_ssl
JOIN pg_stat_activity ON pg_stat_ssl.pid = pg_stat_activity.pid
WHERE ssl!='t'


Let’s break down the components of this query:


SELECT Clause: The query selects the following …

check connections database devops encryption extract information postgresql postrges process purpose query security sockets sql sql query ssl ssl encryption system

Security Operations Program Manager

@ Microsoft | Redmond, Washington, United States

Sr. Network Security engineer

@ NXP Semiconductors | Bengaluru (Nagavara)

DevSecOps Engineer

@ RP Pro Services | Washington, District of Columbia, United States

Consultant RSSI H/F

@ Hifield | Sèvres, France

TW Senior Test Automation Engineer (Access Control & Intrusion Systems)

@ Bosch Group | Taipei, Taiwan

Cyber Security, Senior Manager

@ Triton AI Pte Ltd | Singapore, Singapore, Singapore