Home > Backend Development > PHP Tutorial > 表关联索引怎么创建

表关联索引怎么创建

WBOY
Release: 2016-06-06 20:51:19
Original
1074 people have browsed it

有SQL语句:

SELECT
	p.*, f.*
FROM
	uchome_posts p
LEFT JOIN uchome_postsfield f ON p.pid = f.pid
WHERE
	p.tid = '1557'
AND p.HASH = '1b622139d19b456e5ea72c8f2056021d'
ORDER BY
	p.pid ASC
LIMIT 0,
 100
Copy after login
Copy after login

但是解释之后如下图:
表关联索引怎么创建

很显然索引没有生效,求如何创建一个表关联的正确索引。

回复内容:

有SQL语句:

SELECT
	p.*, f.*
FROM
	uchome_posts p
LEFT JOIN uchome_postsfield f ON p.pid = f.pid
WHERE
	p.tid = '1557'
AND p.HASH = '1b622139d19b456e5ea72c8f2056021d'
ORDER BY
	p.pid ASC
LIMIT 0,
 100
Copy after login
Copy after login

但是解释之后如下图:
表关联索引怎么创建

很显然索引没有生效,求如何创建一个表关联的正确索引。

你觉得是哪个索引没有生效?如果你指的是using filesort那么看看p.HASH字段加了索引了吗,并且using file sort和索引并不一定有直接关系。可以参考这篇文章
http://www.taobaodba.com/html/235_mys...

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template