Jump to content

OR fields selector slower


elabx
 Share

Recommended Posts

I have a site I'm maintaining where I observe this two queries, and the only difference being one field

Avg. 0.005s

pages.find(parent=1082,template=ad,city_id|cities=11669,ad_status!=1, sort=-created, sort=-verified, limit=21, get_total=count)

Avg. 078s

pages.find(template=ad, parent=1082, ad_status=1, sort=-verified, sort=-created, city_id=11669, created_users_id!=41, title!=test|Test, status<1024)

Average times from ProfilerPro.

Event though the second query has more fields, I can confirm that the presence of "city_id|cities" or selector is what's making the query at the top spike.

Is there a chance anybody know how to do this OR selection comparable to the second query performance? I've checked my indexes (compared the current ones with a new install of processwire) and they seem to be ok. Maybe this is just a caveat of the OR-field selector??

EDIT: This seems to be at least around twice faster:

Avg. 0.035s	

pages.find(parent=1082,template=ad,(city_id=11669), (cities=11669),ad_status!=1, sort=-created, sort=-verified, limit=21, get_total=count)

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...