Re: Help understanding indexes, explain, and optimizing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris escribió:
Have you done an 'analyze' or 'vacuum analyze' over these tables?

A left outer join gets *everything* from the second table:

> LEFT OUTER JOIN groups ON groups.id = locations.group_id
> LEFT OUTER JOIN schools ON schools.location_id = locations.id

So they will load everything from groups and schools. Maybe they should be left join's not left outer joins?


Yes, I did that. I tried your other suggestion and it did improve it by about 200ms.

I also repurposed the query by selecting first from the groups table and joining with the locations and schools tables, and that made all the difference. Now it's down to
32ms. Yipee!

Thanks!

Ivan V.



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux