3

I've been reading a little about entity field queries.

What are the advantages of using entity field queries (EFQ) over views?

What are the largest pain points/disadvantages of using EFQ ?

5

Advantages of EFQ:

  1. It's in Core, so you don't actually depend on an extra contrib module. Sometimes Views isn't considered an option.
  2. It's very easy to handle programmatically, while Views is kinda awkward to handle in code.
  3. I have made no performance measurements, but based on the fact that EFQ's are simpler than Views, I believe it will often have better performance.

Advantages of Views:

  1. You can do (almost) arbitrary joins and collect most any kind of data. EFQ finds entites and their fields, period. It's also fairly easy to expose new data to Views. There's even a module for that.
  2. It has a UI, and is as such far more user-friendly than building everything in code.
  3. Views can easily be cached. An EFQ needs custom logic for this.
1
  • 4
    Big disadvantage of EFQs: No support for OR in conditions – Clive May 9 '12 at 19:52
4

Views cannot perform queries on databases other than relational db (eg Mongodb | NO-SQL). However with EFQ, you can now perform complex queries against No-SQL databases including joins. Hence greater scalability and relatively good performace as well.

However as of now you can also combine Views UI with EFQ with an updated module called efq_views. This way you get a UI and backend power of EFQ.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.