Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Steve Smith 75 posts 158 karma points
    Sep 27, 2018 @ 18:11
    Steve Smith

    Deleted media item causing database hits when referenced in partial views

    Hello guys,

    We're currently in the final throws of preparing an Umbraco 7 site for launch, and checking/chasing performance improvements.

    On using miniprofiler, I noticed a partial view on our site home page was responsible for hitting the database with SQL queries. Given that I thought most of the front-end stuff in Umbraco didn't touch the database, I thought it was a bit strange.

    After looking in to the problem, it seems to be because a couple of media items referenced by a content page, had been deleted from the "Media" tab.

    If this happens, then just doing something like...


    ... causes a database hit.

    I also tried:


    ... but still a database query is initiated.

    Is there something wrong with the way we're accessing Media? Is there some way to check if a media item has been binned without causing a database query to happen?

    Many thanks,


Please Sign in or register to post replies

Write your reply to: