Copied to clipboard

Flag this post as spam?

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

  • Richard 69 posts 152 karma points
    Dec 17, 2018 @ 16:54

    Are Macros heavy on SQL server requests?

    I haven't used Macros much in the past since Umbraco 4 (maybe 6). But a new site that I have taken on has a heavy dependency on Macros.

    It doesn't seem very efficient and when I have been using a profiler it is showing many SQL calls per page for the Macro Parameters.

    Would I be best to avoid (write out) Macros altogether if I want to make the site more efficient?

  • Nik 1011 posts 4132 karma points MVP c-trib
    Dec 17, 2018 @ 17:05

    Hi Richard,

    It's a hard one to answer I think.

    I guess it depends what the Macro's are doing.

    As I understand it, a Macro call doesn't necessarily hit the database (but forgive me I could be wrong as I haven't fully investigated that side of things)... I would have been more inclined to think that there is something in the Macro Partial View that is actually hitting the database so I'd start investigating there.

    Macro's have a caching option, which you can enable/disabled I believe. But use that with caution.


  • Richard 69 posts 152 karma points
    Dec 18, 2018 @ 10:25

    It seems to be calling the database for the MacroParameters.

    As these are per page where the Macro is used and different Macros could be used with different parameters per page it means that it will still need to hit the database per page.

    It could then be cached but if you have, for example 1000 blog pages, thats a lot of database hits and then a lot of additional caching.

  • Alex Skrypnyk 5063 posts 18415 karma points MVP 2x admin c-trib
    Dec 18, 2018 @ 00:48
    Alex Skrypnyk

    Hi Richard

    Use MiniProfiler to understand what part of the code is using the database the most. Check out the article how to use Miniprofiler -



  • Richard 69 posts 152 karma points
    Dec 18, 2018 @ 13:58

    Alex, Tried the MiniProfiler but can't get it to display anything at all.

  • Biagio Paruolo 1444 posts 1563 karma points c-trib
    Dec 18, 2018 @ 10:53
    Biagio Paruolo

    Check with SQL Profiler into SQL Management Studio wich is the heavy query or task that SQL execute. Maybe the database need some external index or optimize some query.

  • Richard 69 posts 152 karma points
    Dec 18, 2018 @ 11:01

    Its not that it needs optimised (maybe that would help). I just want to eliminate all database calls from my front end site to render a page.

Please Sign in or register to post replies

Write your reply to: