I have optimized for mysql the question of using CONCAT in JOIN. I have two tables:
pages
(id, type, title, content)
1, 'front', 'Welcome', 'content text'
2, 'page', 'Page 2', 'more content'
paths
(pid, syspath, cleanpath)
98, 'front / 1', '/'
99, 'page / 2', '/ contact'
To select content using the path I use:
SELECT c.title, c.content, u.cleanpath
FROM pages c
LEFT JOIN paths p ON p.syspath = CONCAT (c.type, '/', c.id);
Now this query is working fine, but it is very slow with lots of entries. How can I speed this up? Should I do this differently?
Unfortunately, I cannot change the datebase schema or syspath field.
Any help would be great, thanks.
source
share