mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +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/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>
|
2007-12-20 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
* src/msgs/zh.msg: Small update (thanks to Shelley Shyan)
|
* 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])).
|
"limit ~w offset ~w ", [Prefix, Limit, Offset])).
|
||||||
|
|
||||||
users_number(LServer) ->
|
users_number(LServer) ->
|
||||||
case ejabberd_config:get_local_option(
|
case element(1, ejabberd_config:get_local_option({odbc_server, LServer})) of
|
||||||
{pgsql_users_number_estimate, 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 ->
|
true ->
|
||||||
ejabberd_odbc:sql_query(
|
ejabberd_odbc:sql_query(
|
||||||
LServer,
|
LServer,
|
||||||
"select reltuples from pg_class "
|
"select reltuples from pg_class where oid = 'users'::regclass::oid");
|
||||||
"where oid = 'users'::regclass::oid");
|
|
||||||
_ ->
|
_ ->
|
||||||
ejabberd_odbc:sql_query(
|
ejabberd_odbc:sql_query(
|
||||||
LServer,
|
LServer,
|
||||||
"select count(*) from users")
|
"select count(*) from users")
|
||||||
|
end;
|
||||||
|
_ ->
|
||||||
|
ejabberd_odbc:sql_query(
|
||||||
|
LServer,
|
||||||
|
"select count(*) from users")
|
||||||
end.
|
end.
|
||||||
|
|
||||||
users_number(LServer, [{prefix, Prefix}]) when is_list(Prefix) ->
|
users_number(LServer, [{prefix, Prefix}]) when is_list(Prefix) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user