mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-02-20 09:47:30 +01:00
Optimize sort order in job parquet files
This commit is contained in:
@@ -844,6 +844,8 @@ func (r *JobRepository) FindJobsBetween(startTimeBegin int64, startTimeEnd int64
|
||||
query = query.Where("NOT EXISTS (SELECT 1 FROM jobtag WHERE jobtag.job_id = job.id)")
|
||||
}
|
||||
|
||||
query = query.OrderBy("job.cluster ASC", "job.subcluster ASC", "job.project ASC", "job.start_time ASC")
|
||||
|
||||
rows, err := query.RunWith(r.stmtCache).Query()
|
||||
if err != nil {
|
||||
cclog.Errorf("Error while running FindJobsBetween query: %v", err)
|
||||
|
||||
@@ -88,6 +88,11 @@ func writeParquetBytes(rows []ParquetJobRow) ([]byte, error) {
|
||||
|
||||
writer := pq.NewGenericWriter[ParquetJobRow](&buf,
|
||||
pq.Compression(&pq.Zstd),
|
||||
pq.SortingWriterConfig(pq.SortingColumns(
|
||||
pq.Ascending("sub_cluster"),
|
||||
pq.Ascending("project"),
|
||||
pq.Ascending("start_time"),
|
||||
)),
|
||||
)
|
||||
|
||||
if _, err := writer.Write(rows); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user