INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: IsMissing Expression - Database Cache?  (Read 1861 times)

lowjoel

  • World Citizen
  • ***
  • Posts: 159
IsMissing Expression - Database Cache?
« on: November 28, 2011, 07:01:48 pm »

Hello,

I was reading rick.ca's excellent Album Art post (http://yabb.jriver.com/interact/index.php?topic=67871.0) and making modifications to fit my needs along the way. One of the things which I want to implement is the ability to detect when album art links are broken (because the music folder has moved -- I store it as Folder.jpg in the same folder) so I modified the Alerts expression to include an If(IsMissing(), Broken Reference, ) statement.

The panes view now is extremely sluggish. I assume that is because MC has to verify the existence of every file as part of pane selection evaluation, and that is a O(n) operation. Is there a way to optimise the database to cache these values?

As an added suggestion: most of my library is on a file server and so my library works through Offline Files and UNC Paths. As part of network detection, and the "Fix broken references" option in Settings, perhaps somehow the functionality can be tied such that IsMissing can be optimised so that the IsMissing values can be updated together with the detection of network availability. Although I think the cache given a particular ageing time span or checking only on start up to be an adequate solution (for now)

Any thoughts?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: IsMissing Expression - Database Cache?
« Reply #1 on: November 28, 2011, 09:11:24 pm »

The IsMissing() function must perform a physical file existence check on each referenced file; otherwise, how would it know a file is missing?  You can cache values yourself by just assigning the return of the function to your own DB field.   But that probably is of little value, since the values will be stale wrt. the file system.
Logged
The opinions I express represent my own folly.

lowjoel

  • World Citizen
  • ***
  • Posts: 159
Re: IsMissing Expression - Database Cache?
« Reply #2 on: November 28, 2011, 09:38:35 pm »

Yes, I know. That's why I'm asking for better program support on the database side. Caching a value for a particular period of time isn't something that can be accomplished by scripts/expressions, can it? Nor is caching a value only for the lifetime of that one program instance?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: IsMissing Expression - Database Cache?
« Reply #3 on: November 28, 2011, 10:21:41 pm »

Instead of adding it to the Panes (where the function has to be re-run), add an expression column:

   if(isequal([Media Type],Image),if(IsMissing(), MISSING,),)

and this will act as your cache.  The column value will be MISSING when the file is missing, and should have reasonable performance.
Logged
The opinions I express represent my own folly.

lowjoel

  • World Citizen
  • ***
  • Posts: 159
Re: IsMissing Expression - Database Cache?
« Reply #4 on: November 28, 2011, 11:03:38 pm »

Okay, so then it's a manual search / sort by column field then. That's a viable workaround, but it'd still be good if it could be a Pane filtering thing though... I agree it's not exactly the most important at this time, but a good to have.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: IsMissing Expression - Database Cache?
« Reply #5 on: November 28, 2011, 11:24:35 pm »

See this topic for a similar conversation:

http://yabb.jriver.com/interact/index.php?topic=66167.0
Logged
The opinions I express represent my own folly.

lowjoel

  • World Citizen
  • ***
  • Posts: 159
Re: IsMissing Expression - Database Cache?
« Reply #6 on: November 28, 2011, 11:29:59 pm »

That makes two of us. I am okay with the workaround as you are, just that hey, if it can be filtered, it'd be fantastic. I mean, it's not every day I start checking for broken references anyway.

I also buy Matt's argument that caching makes things error prone (certainly at least more complex, which tends towards error prone), hence I'm not thinking this would (and should) be of a high priority. But in case the database architecture does get a revamp, this can be one of those things that can be considered.
Logged
Pages: [1]   Go Up