Best practice for node types still _name?

Hey,

We’ve been using Dgraph since 1.0. For a long type it’s been said that the best way to add “types” to nodes are to use an empty _node predicate where node is the type. However, in the newest blog post https://blog.dgraph.io/post/migrating-from-sql-to-dgraph/ I see you have comment.id, as it’s own predicate, where it seems the type is in the field name.

Is it still ideal to use _node or should we switch to node.id?
https://docs.dgraph.io/howto/#giving-nodes-a-type

I’m asking because we currently use _node and then have a field called id that has an int @index on it. In the blog post, I’d imagine there would be an index on each comment.id, post.id, etc and if those were to be indexed, it would help prevent transaction abortions across node types.

I do not see why to change. Each procedure has its reasons for use. It will depend on what you are doing. Types based on empty predicates are good for using filters and being short/economical. Types based on defined predicates are good for using indexing. But it uses more space and adds a little bit of work load (nothing very significant) to the Dgraph processes.

However, Dgraph is migrating to a typed System. You will have to have types anyway, starting with version 1.1.