This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Which is the faster: objects.tagcache or objecttags?
#1
When the tags on an object are changed, which is updated faster? For instance, when adding a tag on an object, which will happen first between these two options?
  • Append the tag in the "tagcache" column of the corresponding row of the table "objects"
  • Add a new row in the "objecttags" table, containing the ID of the object + the tag just added

I'm asking the question because I'm conceiving a web app that might sometimes add/remove a lot of tags from a lot of objects. So, I want the JavaScript code to send an HTTP request to a .Lp endpoint that will fetch what are the current tags of the modified objects. In that context, I was wondering what would be the best practice in that .lp file

SELECT tagcache FROM objects WHERE id in (...)

orĀ 

SELECT object, tag FROM object in (...)
Reply
#2
You should use grp.gettags instead of doing direct db queries. Performance difference is minimal.
Reply
#3
And what if we want to update the tags of ALL objects because the tags of other objects might also have changed (because of external scripts)? To get the list of all objects, we would have to execute grp.all(), but since every item in this list already has a tagcache, would that be sufficient?

or would we have to loop over all the results of grp.all() and apply the function grp.gettags to each of the results? This seems a bit heavy
Reply
#4
Calling grp.gettags in a loop will be slower than using tagcache. For a large object list you can use tagcache directly.
Reply


Forum Jump: