Help Center/
Relational Database Service_RDS for PostgreSQL/
FAQs/
Database Usage/
How Do I View Session IDs and Login and Logout Time of an RDS Database?
Updated on 2025-09-11 GMT+08:00
How Do I View Session IDs and Login and Logout Time of an RDS Database?
- View database login and logout time in SQL audit logs. For details about how to enable SQL audit, see Enabling SQL Audit.
- To view sessions, run the following commands in the database:
SELECT pid AS session_id, usename AS login_user, datname AS database_name, backend_start AS login_time, state, query FROM pg_stat_activity ORDER BY backend_start DESC;
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot