- Kyoto, Japan
- https://pvv.ntnu.no/~oysteikt/
-
ワンワン :3 :3 :3
- Joined on
2023-06-04
Block a user
show-db is unreasonably slow, figure out why
This seems to be it
muscl/src/server/sql/database_operations.rs
Lines 314 to 345 in f16239aceb
pub async fn list_all_databases_for_user(
|
|
unix_user: &UnixUser,
|
|
connection: &mut MySqlConnection,
|
|
_db_is_mariadb: bool,
|
|
group_denylist: &GroupDenylist,
|
|
) -> ListAllDatabasesResponse {
|
|
let result = sqlx::query_as::<_, DatabaseRow>(
|
|
r"
|
|
SELECT
|
|
CAST(`information_schema`.`SCHEMATA`.`SCHEMA_NAME` AS CHAR(64)) AS `database`,
|
|
GROUP_CONCAT(DISTINCT CAST(`information_schema`.`TABLES`.`TABLE_NAME` AS CHAR(64)) SEPARATOR ',') AS `tables`,
|
|
GROUP_CONCAT(DISTINCT CAST(`mysql`.`db`.`User` AS CHAR(64)) SEPARATOR ',') AS `users`,
|
|
MAX(`information_schema`.`SCHEMATA`.`DEFAULT_COLLATION_NAME`) AS `collation`,
|
|
MAX(`information_schema`.`SCHEMATA`.`DEFAULT_CHARACTER_SET_NAME`) AS `character_set`,
|
|
CAST(IFNULL(
|
|
SUM(`information_schema`.`TABLES`.`DATA_LENGTH` + `information_schema`.`TABLES`.`INDEX_LENGTH`),
|
|
0
|
|
) AS UNSIGNED INTEGER) AS `size_bytes`
|
|
FROM `information_schema`.`SCHEMATA`
|
|
LEFT OUTER JOIN `information_schema`.`TABLES`
|
|
ON `information_schema`.`SCHEMATA`.`SCHEMA_NAME` = `TABLES`.`TABLE_SCHEMA`
|
|
LEFT OUTER JOIN `mysql`.`db`
|
|
ON `information_schema`.`SCHEMATA`.`SCHEMA_NAME` = `mysql`.`db`.`DB`
|
|
WHERE `information_schema`.`SCHEMATA`.`SCHEMA_NAME` NOT IN ('information_schema', 'performance_schema', 'mysql', 'sys')
|
|
AND `information_schema`.`SCHEMATA`.`SCHEMA_NAME` REGEXP ?
|
|
GROUP BY `information_schema`.`SCHEMATA`.`SCHEMA_NAME`
|
|
",
|
|
)
|
|
.bind(create_user_group_matching_regex(unix_user, group_denylist))
|
|
.fetch_all(connection)
|
|
.await
|
|
.map_err(|err| ListAllDatabasesError::MySqlError(err.to_string()));
|
show-db is unreasonably slow, figure out why
May 30 18:31:18 isvegg muscl-server[1000070]: Request:
{
"ListDatabases": null
…
show-db is unreasonably slow, figure out why
Replace SQLite linked lists with BASIC-like arrays
Implementation is done, but we need to keep parts of the old implementation around for #104
Implement reordering algorithm for BASIC lists
Test size getters and "get page" functions with unbalanced pages