anchor.diff:        (format nil "~A:~A" impl
                 (string-downcase (format nil "~A~@[/~S~]" arch features))))))
   
  -(defun emit-image-index (s &rest args &key host only-release implementations &allow-other-keys)
  -  (let* ((benchmarks (pg-result (pg-exec *dbconn*
  -                                         (translate* `(distinct (select (b-name unit)
  -                                                                        (where
  -                                                                         (join result benchmark
  -                                                                               :on (= result.b_name benchmark.name))
  -                                                                         (in result.m-name ',host)))))) :tuples))
  -         (date-boundaries (apply #'date-boundaries args))
  -         (earliest (first date-boundaries))
  -         (latest (second date-boundaries)))
  +(defun emit-image-index (s &rest args &key earliest latest host only-release implementations &allow-other-keys)
  +  (let ((benchmarks (pg-result (pg-exec *dbconn*
  +                                        (translate*
  +                                         `(select (name unit)
  +                                                  (where benchmark
  +                                                         (exists
  +                                                          (limit
  +                                                           (select (*)
  +                                                                   (where result
  +                                                                          (and (= result.b_name benchmark.name)
  +                                                                               (in result.m-name ',host))))
  +                                                           :end 1))))))
  +                               :tuples)))
       (iterate (for (benchmark unit) in benchmarks)
                (apply #'ensure-image-file-exists
                       :unit unit
  
positive.code: (in-package :autobench-web)
  
  (defparameter *site-name* "sbcl.boinkor.net")
  
  
negative.code:                                      (format *debug-io* "Caught timeout ~A. continuing...~%" c)
                                       (invoke-restart (find-restart 'continue c)))))
      (with-db-connection *dbconn*
        (param-bind ((host (list "baker") t)
                     (only-release nil)
                     (implementations (all-implementations-of-host host t) t)) request
              
          (let* ((date-boundaries (date-boundaries :host host :only-release only-release))
                 (earliest (first date-boundaries))
                 (latest (second date-boundaries))
                 (*latest-result* (first (pg-result (pg-exec *dbconn*
                                                             (translate*
                                                              `(select ((max date))
                                                                       (where (join result version
                                                                                    :on (and (= version v-version) (= i-name v-name)))
                                                                              (and (in v-name
                                                                                       ',(mapcar
                                                                                          (lambda (impl)
                                                                                            (subseq impl 0 (position #\, impl)))
                                                                                          implementations))
                                                                                   (< release-date ,latest)
                                                                                   (> release-date ,earliest))))))
                                                    :tuple 0))))
            (request-send-headers request
                                  :expires  (+ 1200 (get-universal-time))
                                  :last-modified *latest-result*
                                  :conditional t) 
            (let ((s (request-stream request)))
              (format s "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">")
              (emit-image-index s
                                :implementations implementations
                                :only-release only-release
                                :host host
                                :earliest earliest
                                :latest latest)))))))
  
  (defun make-select (name default options)
    `((select :name ,name :id ,name)
  