Re: help optimise this ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: help optimise this ?
Дата
Msg-id 12120.1037893611@sss.pgh.pa.us
обсуждение исходный текст
Ответ на help optimise this ?  ("Peter Galbavy" <peter.galbavy@knowtion.net>)
Список pgsql-sql
"Peter Galbavy" <peter.galbavy@knowtion.net> writes:
> I want to then find either the largest (max) or smallest (min) version of an
> image that falls within some range of sizes:

Depends on how you want to define "largest" and "smallest", but if
"area" is a good enough definition, seems like this would work:

select file_md5 from image_instance
where md5 = '546b94e94851a56ee721f3b755f58462'   and image_width between 0 and 160   and image_length between 0 and
160
order by image_width * image_length
limit 1;

Probably an index on md5 would be sufficient to make this go fast ---
I assume you're not going to be storing a vast number of sizes of
the same image.
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Date trunc in UTC
Следующее
От: "Peter Galbavy"
Дата:
Сообщение: Re: help optimise this ?