Copied to clipboard

Flag this post as spam?

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


  • Richard Hamilton 79 posts 169 karma points
    Dec 17, 2018 @ 16:54
    Richard Hamilton
    0

    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 1617 posts 7263 karma points MVP 7x c-trib
    Dec 17, 2018 @ 17:05
    Nik
    1

    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.

    Nik

  • Richard Hamilton 79 posts 169 karma points
    Dec 18, 2018 @ 10:25
    Richard Hamilton
    0

    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 6175 posts 24186 karma points MVP 8x admin c-trib
    Dec 18, 2018 @ 00:48
    Alex Skrypnyk
    100

    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 - http://jondjones.com/learn-umbraco-cms/umbraco-developers-guide/umbraco-troubleshooting/how-to-debug-your-umbraco-7-website

    Thanks,

    Alex

  • Richard Hamilton 79 posts 169 karma points
    Dec 18, 2018 @ 13:58
    Richard Hamilton
    0

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

  • Biagio Paruolo 1619 posts 1912 karma points c-trib
    Dec 18, 2018 @ 10:53
    Biagio Paruolo
    1

    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 Hamilton 79 posts 169 karma points
    Dec 18, 2018 @ 11:01
    Richard Hamilton
    0

    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:

Draft