大型mysql数据库中sql查询的响应速度
我的数据库中有一个表,它有 300684 条记录,问题是当我执行 sql 查询时,响应需要很长时间,所以是否有提高响应时间的解决方案?我在 phpmyadmin 工作,我不喜欢使用另一个 SGBD.谢谢
I have a table in my database which has 300684 records and the problem is when i execute an sql query the response takes very long time so is there a solution for raising the time of response ? I work in phpmyadmin and i don't prefer to use another SGBD. Thank you
这是我的查询:
SELECT * FROM `gipeord_conjoint` WHERE COD_AG in ( select PPR from
gestion_delegation.dataidentifpersonnel)
两个表gipeord_conjoint
和dataidentifpersonnel
在两个不同的数据库中,这是第一个gipeord_conjoint
的结构:
the two tables gipeord_conjoint
and dataidentifpersonnel
are in two different database and this is the structure of the first one gipeord_conjoint
:
COD_AG int
NUM_CONJ int
SIT_CONJ varchar
PRF_CONJ varcha
NAT_CONJ varchar
DOTI_CONJ int
CIN_CONJ varchar
这是dataidentifpersonnel的结构:
and this is the structure of dataidentifpersonnel :
PPR int
CIN varchar
CD_POSITION varchar
CD_NATION varchar
CD_DIPS varchar
CD_DISCIP varchar
CD_STATUT varchar
......
从不...使用 Select *... EVER.
这就像是在说:
我的电脑比平时慢,你能解释一下为什么吗?
Hi my computer is slower than usual can you explain why ?
如果您需要我们提供更具体的帮助,您需要向我们展示您的问题.
You need to show us your query if you want more specific help from our part.
就您目前的情况而言,300,684 条记录并不多,因此这不是查询速度缓慢的原因.
As for your current case, 300,684 records is not that much so it's not a reason to have a slow query.
我的头顶:
- 您的查询可能未优化.查看执行计划.(我会寻找表格扫描)
- 确保您有正确的索引.
- 看看有多少人同时运行请求.
- 检查谁在查询数据库以及查询来自哪里.
- Your query could be not-optimized. Take a look at the execution plan. (I'd look for table scans)
- Make sure you have proper indexes.
- Take a look at how many people are running requests at the same time.
- Check who's querying the database and where is the query comming from.
添加您的查询,以便我提供更多帮助.
Add your query so I can help more.