Re: help optimise this ?

From: "Peter Galbavy" <peter(dot)galbavy(at)knowtion(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: help optimise this ?
Date: 2002-11-21 15:49:53
Message-ID: 006601c29175$a21ce900$4528a8c0@cblan.mblox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Wow. Three people have replied with an effectively identical solution.

Why didn't I think of this ? Answers on a postcard to...

Thanks to all that have replied.

Peter
----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter Galbavy" <peter(dot)galbavy(at)knowtion(dot)net>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Thursday, November 21, 2002 3:46 PM
Subject: Re: [SQL] help optimise this ?

> "Peter Galbavy" <peter(dot)galbavy(at)knowtion(dot)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
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas O'Connell 2002-11-21 18:53:46 Re: [GENERAL] Bug with sequence
Previous Message Tom Lane 2002-11-21 15:46:51 Re: help optimise this ?