25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

User count performance improvements

SVN Revision: 1086
This commit is contained in:
Christophe Romain 2007-12-20 17:12:45 +00:00
parent 583f2fd19f
commit 1ba15b207c
2 changed files with 19 additions and 7 deletions

View File

@ -6,6 +6,9 @@
* src/mod_pubsub/mod_pubsub.erl: PEP notification bugfix
* src/odbc/odbc_queries.erl: User count performance improvements
(EJAB-239)
2007-12-20 Badlop <badlop@process-one.net>
* src/msgs/zh.msg: Small update (thanks to Shelley Shyan)

View File

@ -147,13 +147,22 @@ list_users(LServer, [{prefix, Prefix},
"limit ~w offset ~w ", [Prefix, Limit, Offset])).
users_number(LServer) ->
case ejabberd_config:get_local_option(
{pgsql_users_number_estimate, LServer}) of
case element(1, ejabberd_config:get_local_option({odbc_server, LServer})) of
mysql ->
ejabberd_odbc:sql_query(
LServer,
"select table_rows from information_schema.tables where table_name='users'");
pgsql ->
case ejabberd_config:get_local_option({pgsql_users_number_estimate, LServer}) of
true ->
ejabberd_odbc:sql_query(
LServer,
"select reltuples from pg_class "
"where oid = 'users'::regclass::oid");
"select reltuples from pg_class where oid = 'users'::regclass::oid");
_ ->
ejabberd_odbc:sql_query(
LServer,
"select count(*) from users")
end;
_ ->
ejabberd_odbc:sql_query(
LServer,