导航:
论坛 -> 数据库专区
斑竹:liumazi,waterstone
作者:
2023/12/23 22:06:02
标题:
这句sql 还能更快吗?72 行返回,耗时 135ms
浏览:729
加入我的收藏
楼主:
CREATE TABLE "on_links" ( "id" INTEGER NOT NULL, "fid" INTEGER(5) NOT NULL, "title" TEXT(64) NOT NULL, "url" TEXT(256) NOT NULL, "description" TEXT(256), "add_time" TEXT(10) NOT NULL, "up_time" TEXT(10), "weight" integer(3) NOT NULL DEFAULT 0, "property" integer(1) NOT NULL DEFAULT 0, "click" integer NOT NULL DEFAULT 0, topping INTEGER DEFAULT 0 NOT NULL, url_standby TEXT(256), font_icon TEXT(512), PRIMARY KEY ("id"), CONSTRAINT "url" UNIQUE ("url") ) CREATE TABLE "on_categorys" ( "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "name" TEXT(32) NOT NULL, "add_time" TEXT(10) NOT NULL, "up_time" TEXT(10) DEFAULT '', "weight" integer(3) NOT NULL DEFAULT 0, "property" integer(1) NOT NULL DEFAULT 0, "description" TEXT(128) DEFAULT '', font_icon TEXT(32), fid INTEGER DEFAULT 0 NOT NULL, CONSTRAINT "name" UNIQUE ("name") ) INSERT INTO "main"."on_categorys" ("id", "name", "add_time", "up_time", "weight", "property", "description", "font_icon", "fid") VALUES ('19', '编程', '1608042122', '1654926068', '99', '0', '编程', 'fa fa-book', '0'); INSERT INTO "main"."on_links" ("id", "fid", "title", "url", "description", "add_time", "up_time", "weight", "property", "click", "topping", "url_standby", "font_icon") VALUES ('118', '19', 'intel指令优化_勇zhe无wei的博客-CSDN博客', 'https://blog.csdn.net/zhangxxxww/article/details/45366773', '', '1657786230', '', '0', '0', '0', '0', '', ''); 执行完成。 结果: 72 行返回,耗时 135ms,好慢阿。。。。。。。。。。 在行 1: SELECT on_categorys.name as category_name ,on_links.* FROM on_links LEFT join on_categorys on on_categorys.id = on_links.fid WHERE on_links.title LIKE '%漫画%' OR on_links.url LIKE '%漫画%' OR on_links.url_standby LIKE '%漫画%' OR on_links.description LIKE '%漫画%' order by fid DESC; 执行完成。 结果: 4431 行返回,耗时 429ms 在行 1: SELECT * FROM on_links 工具:DB Browser for SQLite 版本 3.12.1
----------------------------------------------
-
作者:
2023/12/24 12:50:14
1楼:
SQLite 本来就慢, 加redis吧.
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
2023/12/24 13:32:40
2楼:
我以为我的sql语句有问题需要优化?。 回头内存里面测试抛开硬盘问题试试。
----------------------------------------------
-
作者:
2023/12/24 17:41:11
3楼:
不过, 你这sql, 建议前期规划好.
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
yookee (yookee)
★☆☆☆☆
-
盒子活跃会员
2023/12/25 17:14:47
4楼:
非数据库设计的问题,你的这两个表并不复杂 且select * from on_links只是最简单的查询语句,记录也才4431个 我这里用笔记本i7-8550U 16G 512GB(SSD) Navicat 0s DB Browser 20ms 找找你机子的问题吧
----------------------------------------------
-