Giter VIP home page Giter VIP logo

Comments (3)

npf avatar npf commented on September 18, 2024

[removed previous comment]
The function is 2 folds, with 2 requests, in order to remove jobs with any resource that is Dead/Suspected/Absent.
In one request, I think we could do:

SELECT g2.moldable_job_id, g1.resource_id, j.job_id
                FROM gantt_jobs_resources g1, gantt_jobs_predictions g2, jobs j, moldable_job_descriptions m, resources r
                WHERE
                    m.moldable_index = \'CURRENT\'
                    AND g1.moldable_job_id = g2.moldable_job_id
                    AND m.moldable_id = g1.moldable_job_id
                    AND j.job_id = m.moldable_job_id
                    AND g2.start_time <= $date
                    AND j.state = \'Waiting\'
                    AND r.resource_id = g1.resource_id
                    AND r.state = \'Alive\'
                    AND NOT EXISTS ( 
                        SELECT 1 
                        FROM resources rr, gantt_jobs_resources g
                        WHERE g.moldable_job_id = g1.moldable_job_id
                            AND rr.resource_id = g.resource_id 
                            AND ( rr.state IN (\'Dead\',\'Suspected\',\Absent\')
                            OR rr.next_state IN (\'Dead\',\'Suspected\',\Absent\') )
                    )

To test ?

from oar.

npf avatar npf commented on September 18, 2024

[updated the request above]

from oar.

npf avatar npf commented on September 18, 2024

As reported by @capitn, having "m.moldable_index = 'CURRENT'" in the where clause actually slows down pgsql.
Fixed in 3e60532, but use the new code with the single query (with "exists in").

from oar.

Related Issues (20)

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.