新增字段与索引
This commit is contained in:
		
							
								
								
									
										28
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								README.md
									
									
									
									
									
								
							@@ -38,22 +38,18 @@ ALTER TABLE web_images ADD COLUMN color_1_r TINYINT UNSIGNED;
 | 
				
			|||||||
ALTER TABLE web_images ADD COLUMN color_1_g TINYINT UNSIGNED;
 | 
					ALTER TABLE web_images ADD COLUMN color_1_g TINYINT UNSIGNED;
 | 
				
			||||||
ALTER TABLE web_images ADD COLUMN color_1_b TINYINT UNSIGNED;
 | 
					ALTER TABLE web_images ADD COLUMN color_1_b TINYINT UNSIGNED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- 为每个字段创建索引
 | 
					-- 为 web_images 表的 color 设置复合索引用于筛选
 | 
				
			||||||
CREATE INDEX idx_color_0_r ON web_images(color_0_r);
 | 
					CREATE INDEX idx_color_0 ON web_images (color_0_r, color_0_g, color_0_b);
 | 
				
			||||||
CREATE INDEX idx_color_0_g ON web_images(color_0_g);
 | 
					CREATE INDEX idx_color_1 ON web_images (color_1_r, color_1_g, color_1_b);
 | 
				
			||||||
CREATE INDEX idx_color_0_b ON web_images(color_0_b);
 | 
					 | 
				
			||||||
CREATE INDEX idx_color_1_r ON web_images(color_1_r);
 | 
					 | 
				
			||||||
CREATE INDEX idx_color_1_g ON web_images(color_1_g);
 | 
					 | 
				
			||||||
CREATE INDEX idx_color_1_b ON web_images(color_1_b);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- 全文索引
 | 
					-- 全文索引
 | 
				
			||||||
CREATE FULLTEXT INDEX idx_images_desc ON web_images (images_desc);
 | 
					CREATE FULLTEXT INDEX idx_images_desc ON web_images (images_desc);
 | 
				
			||||||
CREATE FULLTEXT INDEX idx_tags ON web_images (tags);
 | 
					CREATE FULLTEXT INDEX idx_tags ON web_images (tags);
 | 
				
			||||||
CREATE FULLTEXT INDEX idx_tags ON web_article (tags);
 | 
					CREATE FULLTEXT INDEX idx_tags ON web_article (tags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- 同步收藏
 | 
					-- -- 同步收藏
 | 
				
			||||||
ALTER TABLE web_praise ADD COLUMN gorse BOOLEAN DEFAULT FALSE;
 | 
					-- ALTER TABLE web_praise ADD COLUMN gorse BOOLEAN DEFAULT FALSE;
 | 
				
			||||||
ALTER TABLE web_praise ADD COLUMN gorse BOOLEAN DEFAULT FALSE;
 | 
					-- ALTER TABLE web_praise ADD COLUMN gorse BOOLEAN DEFAULT FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- 排序内存
 | 
					-- 排序内存
 | 
				
			||||||
@@ -65,15 +61,15 @@ CREATE INDEX idx_id_desc ON web_images (id DESC);
 | 
				
			|||||||
-- 复合筛选降序索引 article_category_top_id
 | 
					-- 复合筛选降序索引 article_category_top_id
 | 
				
			||||||
CREATE INDEX idx_acti_id_desc ON web_images (article_category_top_id, id DESC);
 | 
					CREATE INDEX idx_acti_id_desc ON web_images (article_category_top_id, id DESC);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- 为 web_images 表的 color 设置复合索引用于筛选
 | 
					-- -- 为 web_images 表的 day_rank 行设置倒序索引用于排序
 | 
				
			||||||
CREATE INDEX idx_color_0 ON web_images (color_0_r, color_0_g, color_0_b);
 | 
					-- CREATE INDEX idx_day_rank_desc ON web_images (day_rank DESC);
 | 
				
			||||||
CREATE INDEX idx_color_1 ON web_images (color_1_r, color_1_g, color_1_b);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- 为 web_images 表的 day_rank 行设置倒序索引用于排序
 | 
					 | 
				
			||||||
CREATE INDEX idx_day_rank_desc ON web_images (day_rank DESC);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- 为 web_images 表创建倒排复合索引
 | 
					-- 为 web_images 表创建倒排复合索引
 | 
				
			||||||
CREATE INDEX idx_article_dayrank ON web_images(article_category_top_id, day_rank DESC);
 | 
					CREATE INDEX idx_article_dayrank ON web_images(article_category_top_id, day_rank DESC);
 | 
				
			||||||
 | 
					CREATE INDEX idx_article_weekrank ON web_images(article_category_top_id, week_rank DESC);
 | 
				
			||||||
 | 
					CREATE INDEX idx_article_monthrank ON web_images(article_category_top_id, month_rank DESC);
 | 
				
			||||||
 | 
					CREATE INDEX idx_article_yearrank ON web_images(article_category_top_id, year_rank DESC);
 | 
				
			||||||
 | 
					CREATE INDEX idx_article_aeonrank ON web_images(article_category_top_id, aeon_rank DESC);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user