From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Galbavy <peter.galbavy@knowtion.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: help optimise this ?
Date: Thu, 21 Nov 2002 10:46:51 -0500
Message-ID: <12120.1037893611@sss.pgh.pa.us> (raw)
In-Reply-To: <001d01c29169$79fd1d20$4528a8c0@cblan.mblox.com>
References: <001d01c29169$79fd1d20$4528a8c0@cblan.mblox.com>
"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, peter.galbavy@knowtion.net
Subject: Re: help optimise this ?
In-Reply-To: <12120.1037893611@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox