Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package join performance #20

Open
fico7489 opened this issue Dec 17, 2017 · 0 comments
Open

package join performance #20

fico7489 opened this issue Dec 17, 2017 · 0 comments

Comments

@fico7489
Copy link

actually this

select 
	 `street`.`<…>` as `__f__street---<…>`,
	 `type`.`<…>` as `__f__street---__f__type---<…>`,
	 `district`.`<…>` as `__f__street---__f__district---<…>`,
	 `street_images`.* 
from 
	`street_images` 
left join 
	`streets` as `street` on `street`.`id` = `street_images`.`street_id` 
left join 
	`street_types` as `type` on `type`.`id` = `street`.`street_type_id` 
left join 
	`districts` as `district` on `district`.`id` = `street`.`district_id` 
order by `sort` asc 
limit 1

instead of this

select `street_images`.* from `street_images` order by `sort` asc limit 1

select `streets`.* from `streets` where `streets`.`id` in (?) order by `title` asc

select * from `street_types` where `street_types`.`id` in (?) order by `title` asc

select * from `districts` where `districts`.`id` in (?) order by `sort` asc

it is not faster and uses more memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant