GithubHelp home page GithubHelp logo

How to reduce queries? about onboard HOT 3 CLOSED

kiogo avatar kiogo commented on July 17, 2024
How to reduce queries?

from onboard.

Comments (3)

calebporzio avatar calebporzio commented on July 17, 2024

I'm not exactly sure. Maybe post your Onboarding config from your service provider? Maybe you are accessing something in there?

Maybe try installing https://github.com/barryvdh/laravel-debugbar to learn more about those queries and where they came from if you aren't doing this already.

from onboard.

adddz avatar adddz commented on July 17, 2024

Loop into this as I just realized I'm experiencing the same issue.

Excerpt of the Onboarding config:

Onboard::addStep('Visit Page')
   ->link('/app/page')
   ->cta('Visit Page')
   ->completeIf(function (User $user) {
       return $user->pageViews()->wherePath($path)->count();
   });

Obviously, the culprit is the query I'm executing. Any ideas on how to improve this without having to make that query every single time (multiplied by the time that complete() is called)?

from onboard.

Jamesking56 avatar Jamesking56 commented on July 17, 2024

@adddz Maybe cache the result of $user->pageViews()->wherePath($path)->count() in that closure?

from onboard.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.