User check
От | Ben Clewett |
---|---|
Тема | User check |
Дата | |
Msg-id | 3E79BE4C.5000000@roadrunner.uk.com обсуждение исходный текст |
Ответ на | Re: Problems with copy ("Duncan Adams (DNS)" <duncan.adams@vcontractor.co.za>) |
Список | pgsql-novice |
PostgreSQL, I want to definitively check whether a user is logged in. I see there is a table pg_stat_activity: ben=# SELECT DISTINCT datname FROM ps_stat_activity Are these better ways, or is this about right? If right, does this table ever become corrupt, eg a TCP connection failure without termination? Whilst I am writing, something which has been bothering me. Does any person know the quickest method for checking the existence of a record, selected by Primary Key? ben=# SELECT pk FROM table WHERE pk = value I guess this way might be performance impared as it has to create the output table with the extracted value. ben=# SELECT COUNT(*) FROM table WHERE pk = value I guess this might be faster, since it's only counting results without creating a table. Or it might be slower if the table has already been created, and then counted... Ever a Novice, Ben.
В списке pgsql-novice по дате отправления: