klesh commented on code in PR #8534:
URL: 
https://github.com/apache/incubator-devlake/pull/8534#discussion_r2275167949


##########
backend/core/models/pipeline.go:
##########
@@ -75,6 +76,7 @@ type NewPipeline struct {
        Name        string       `json:"name"`
        Plan        PipelinePlan `json:"plan" swaggertype:"array,string" 
example:"please check api /pipelines/<PLUGIN_NAME>/pipeline-plan"`
        Labels      []string     `json:"labels"`
+       Priority    int          `json:"priority"` // greater is higher

Review Comment:
   Good question!
   Here’s why I didn’t define an index for it:
   
   - Indexes improve `SELECT` performance but add overhead to `INSERT` and 
`UPDATE` operations. If we were to create one here, it would likely need to 
include `status`, `priority`, and then `id`. The cost would be higher.
   
   - The `WHERE` clause filters only the pending pipelines, which I expect to 
be a relatively small set. This makes the `ORDER BY` operation inexpensive.
   
   Given the cost–benefit trade-off, I decided not to create an index in this 
case.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to