album,artist请求增加超时时间;小调整
This commit is contained in:
44
netease_music/sql/generator.js
Normal file
44
netease_music/sql/generator.js
Normal file
@@ -0,0 +1,44 @@
|
||||
var table = [
|
||||
"song",
|
||||
"album",
|
||||
"artist",
|
||||
"comment",
|
||||
"lyric",
|
||||
"user",
|
||||
"category",
|
||||
"playlist",
|
||||
|
||||
"comment_progress",
|
||||
"song_album_relation",
|
||||
"song_artist_relation",
|
||||
"song_playlist_relation",
|
||||
|
||||
"wait_check_album",
|
||||
"wait_check_artist",
|
||||
"wait_check_comment",
|
||||
"wait_check_lyric",
|
||||
"wait_check_song",
|
||||
|
||||
"wait_fetch_album",
|
||||
"wait_fetch_artist",
|
||||
"wait_fetch_lyric",
|
||||
"wait_fetch_song",
|
||||
|
||||
"analysis",
|
||||
"log",
|
||||
|
||||
"hifini_forum",
|
||||
"hifini_tag",
|
||||
"hifini_thread",
|
||||
"hifini_thread_tag_relation",
|
||||
];
|
||||
|
||||
let sqlList = [];
|
||||
|
||||
// OPTIMIZE TABLE
|
||||
table.forEach((tableName) => sqlList.push(`OPTIMIZE TABLE ${tableName};`));
|
||||
|
||||
// RENAME TABLE 移动数据库
|
||||
// table.forEach((tableName) => sqlList.push(`RENAME TABLE neteasemusic.${tableName} TO neteasemusic_develop.${tableName};`));
|
||||
|
||||
console.log(sqlList.join('\n'));
|
@@ -19,6 +19,27 @@ INSERT INTO analysis (`key`, `value`) VALUES ('songArtistCount', (SELECT count(*
|
||||
|
||||
|
||||
-- 更新后初次全表扫描
|
||||
INSERT IGNORE INTO wait_check_song (id) SELECT song_id FROM song_artist_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
INSERT IGNORE INTO wait_check_song (id) SELECT song_id FROM song_album_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
INSERT IGNORE INTO wait_check_song (id) SELECT song_id FROM song_playlist_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
|
||||
INSERT IGNORE INTO wait_check_lyric (id) SELECT song_id FROM song_artist_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
INSERT IGNORE INTO wait_check_lyric (id) SELECT song_id FROM song_album_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
INSERT IGNORE INTO wait_check_lyric (id) SELECT song_id FROM song_playlist_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
INSERT IGNORE INTO wait_check_lyric (id) SELECT song_id FROM song WHERE create_time > '2022-10-28 00:00:00';
|
||||
|
||||
INSERT IGNORE INTO wait_check_comment (id) SELECT song_id FROM song_artist_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
INSERT IGNORE INTO wait_check_comment (id) SELECT song_id FROM song_album_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
INSERT IGNORE INTO wait_check_comment (id) SELECT song_id FROM song_playlist_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
INSERT IGNORE INTO wait_check_comment (id) SELECT song_id FROM song WHERE create_time > '2022-10-28 00:00:00';
|
||||
|
||||
INSERT IGNORE INTO wait_check_artist (id) SELECT artist_id FROM song_artist_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
|
||||
INSERT IGNORE INTO wait_check_album (id) SELECT album_id FROM song_album_relation WHERE create_time > '2022-10-28 00:00:00';
|
||||
|
||||
|
||||
|
||||
-- 全量更新
|
||||
INSERT IGNORE INTO wait_check_song (id) SELECT song_id FROM song_artist_relation WHERE song_id NOT IN ( SELECT song_id FROM song );
|
||||
INSERT IGNORE INTO wait_check_song (id) SELECT song_id FROM song_album_relation WHERE song_id NOT IN ( SELECT song_id FROM song );
|
||||
INSERT IGNORE INTO wait_check_song (id) SELECT song_id FROM song_playlist_relation WHERE song_id NOT IN ( SELECT song_id FROM song );
|
||||
@@ -103,59 +124,6 @@ ORDER BY s DESC
|
||||
|
||||
|
||||
|
||||
-- optimize table
|
||||
optimize table analysis;
|
||||
optimize table album;
|
||||
optimize table artist;
|
||||
optimize table category;
|
||||
optimize table comment;
|
||||
optimize table comment_progress;
|
||||
optimize table log;
|
||||
optimize table lyric;
|
||||
optimize table playlist;
|
||||
optimize table song;
|
||||
optimize table song_album_relation;
|
||||
optimize table song_artist_relation;
|
||||
optimize table song_playlist_relation;
|
||||
optimize table user;
|
||||
optimize table wait_check_album;
|
||||
optimize table wait_check_artist;
|
||||
optimize table wait_check_lyric;
|
||||
optimize table wait_check_song;
|
||||
optimize table wait_fetch_album;
|
||||
optimize table wait_fetch_artist;
|
||||
optimize table wait_fetch_lyric;
|
||||
optimize table wait_fetch_song;
|
||||
|
||||
|
||||
|
||||
-- 移动数据库
|
||||
RENAME TABLE neteasemusic.analysis TO neteasemusic_develop.analysis;
|
||||
RENAME TABLE neteasemusic.album TO neteasemusic_develop.album;
|
||||
RENAME TABLE neteasemusic.artist TO neteasemusic_develop.artist;
|
||||
RENAME TABLE neteasemusic.category TO neteasemusic_develop.category;
|
||||
RENAME TABLE neteasemusic.comment TO neteasemusic_develop.comment;
|
||||
RENAME TABLE neteasemusic.comment_progress TO neteasemusic_develop.comment_progress;
|
||||
RENAME TABLE neteasemusic.log TO neteasemusic_develop.log;
|
||||
RENAME TABLE neteasemusic.lyric TO neteasemusic_develop.lyric;
|
||||
RENAME TABLE neteasemusic.playlist TO neteasemusic_develop.playlist;
|
||||
RENAME TABLE neteasemusic.song TO neteasemusic_develop.song;
|
||||
RENAME TABLE neteasemusic.song_album_relation TO neteasemusic_develop.song_album_relation;
|
||||
RENAME TABLE neteasemusic.song_artist_relation TO neteasemusic_develop.song_artist_relation;
|
||||
RENAME TABLE neteasemusic.song_playlist_relation TO neteasemusic_develop.song_playlist_relation;
|
||||
RENAME TABLE neteasemusic.user TO neteasemusic_develop.user;
|
||||
RENAME TABLE neteasemusic.wait_check_album TO neteasemusic_develop.wait_check_album;
|
||||
RENAME TABLE neteasemusic.wait_check_artist TO neteasemusic_develop.wait_check_artist;
|
||||
RENAME TABLE neteasemusic.wait_check_lyric TO neteasemusic_develop.wait_check_lyric;
|
||||
RENAME TABLE neteasemusic.wait_check_song TO neteasemusic_develop.wait_check_song;
|
||||
RENAME TABLE neteasemusic.wait_fetch_album TO neteasemusic_develop.wait_fetch_album;
|
||||
RENAME TABLE neteasemusic.wait_fetch_artist TO neteasemusic_develop.wait_fetch_artist;
|
||||
RENAME TABLE neteasemusic.wait_fetch_lyric TO neteasemusic_develop.wait_fetch_lyric;
|
||||
RENAME TABLE neteasemusic.wait_fetch_song TO neteasemusic_develop.wait_fetch_song;
|
||||
|
||||
|
||||
|
||||
|
||||
-- 查询单个数据库里面各个表所占磁盘空间大小包括其索引的大小
|
||||
SELECT
|
||||
table_schema AS '数据库',
|
||||
@@ -170,28 +138,3 @@ WHERE
|
||||
table_schema = 'neteasemusic'
|
||||
ORDER BY
|
||||
table_rows DESC;
|
||||
|
||||
|
||||
|
||||
-- analysis
|
||||
-- album
|
||||
-- artist
|
||||
-- category
|
||||
-- comment
|
||||
-- comment_progress
|
||||
-- log
|
||||
-- lyric
|
||||
-- playlist
|
||||
-- song
|
||||
-- song_album_relation
|
||||
-- song_artist_relation
|
||||
-- song_playlist_relation
|
||||
-- user
|
||||
-- wait_check_album
|
||||
-- wait_check_artist
|
||||
-- wait_check_lyric
|
||||
-- wait_check_song
|
||||
-- wait_fetch_album
|
||||
-- wait_fetch_artist
|
||||
-- wait_fetch_lyric
|
||||
-- wait_fetch_song
|
||||
|
Reference in New Issue
Block a user