12

I have a lot of custom functions; I just want to make sure I'm doing this right.
If I want the most recent version—the live version—of a node, I go to the field_data_field_xyz table, right?

My understanding is the field_revision_field_xyz keeps all older versions, correct?

1 Answer 1

13

That is correct: Working with Field SQL Storage.

Database tables:

  • {field_data_[field_name]} Standard data storage for a field.
  • {field_revision_[field_name]} Standard revision storage for a field.
4
  • 1
    It's not very recommended to query these tables directly but I'll do it on many projects. Have a look at EntityFieldQuery and this answer.
    – tostinni
    Commented Sep 21, 2011 at 0:04
  • Yeah there were a bunch of places where Views just wouldn't cut it. What's the biggest downfall to querying the tables directly though?
    – Mike
    Commented Sep 21, 2011 at 15:38
  • IN D6 it was that field could change from the tabtle content_type_* to its own table, so you'd better use the API to build your query. In D7 this doesn't happen anymore so that's better ;)
    – tostinni
    Commented Sep 21, 2011 at 20:05
  • 1
    This answer is not 100% clear. If I needed to write SQL to be able to export the most current data, can I simply ignore the field_revision_field_* tables, or do I need to incorporate them into my export somehow, and if so, how? Commented Apr 25, 2016 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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