Re: ORDER BY what?

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: ORDER BY what?
Date: 2001-06-11 22:37:33
Message-ID: 20010611173733.B29434@serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On Mon, Jun 11, 2001 at 11:19:31AM +0300, Mart?n Marqu?s wrote:
> I have a quite complex select query on postgres (obviously :-) ) using PHP
> (which is not the problem at the moment) which has some text searches using
> LIKE.
> My question is: "How can I write an ORDER BY statment so that it's ordered by
> the amount of matches it gets?"
> Is this posible without getting ichy with the programing?

<guess>

not likely. :) sounds like programming is gonna be
required.

you may be better off with some of the "contrib" features
including full-text-index (of which i have no working
knowledge). or a fancy pl/pgsql function. or a mod_perl glue
layer to coordinate your results...

</guess>

and using LIKE can be a serious performance drag if you use the
leading percent: "...LIKE '%this%'..." can't use any indexes
so it'll scan the whole database stem to stern. if you can stick
with "...LIKE 'this%'..." it'll at least be able to use the
indexes.

--
I figure: if a man's gonna gamble, may as well do it
without plowing. -- Bama Dillert, "Some Came Running"

will(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Pilosov 2001-06-11 22:53:04 Re: What the heck is happening here?
Previous Message Paul Tomblin 2001-06-11 22:17:31 Re: What the heck is happening here?

Browse pgsql-sql by date

  From Date Subject
Next Message David Olbersen 2001-06-11 23:23:29 Re: [SQL] ORDER BY what?
Previous Message JWR 2001-06-11 20:37:42 Re: update from another table