CREATE INDEX idx_jobslines_ordering ON joblines (jobid, removed, line_no asc) where removed=false;