mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-12 17:01:52 +01:00
User count performance improvements
SVN Revision: 1086
This commit is contained in:
parent
583f2fd19f
commit
1ba15b207c
@ -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)
|
||||
|
@ -147,17 +147,26 @@ 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");
|
||||
LServer,
|
||||
"select reltuples from pg_class where oid = 'users'::regclass::oid");
|
||||
_ ->
|
||||
ejabberd_odbc:sql_query(
|
||||
LServer,
|
||||
"select count(*) from users")
|
||||
LServer,
|
||||
"select count(*) from users")
|
||||
end;
|
||||
_ ->
|
||||
ejabberd_odbc:sql_query(
|
||||
LServer,
|
||||
"select count(*) from users")
|
||||
end.
|
||||
|
||||
users_number(LServer, [{prefix, Prefix}]) when is_list(Prefix) ->
|
||||
|
Loading…
Reference in New Issue
Block a user