Received: from server (client-sp03-85.speedex.net [208.33.90.85]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5BMbkE23453 for ; Mon, 11 Jun 2001 18:37:46 -0400 (EDT) (envelope-from will@serensoft.com) Received: from will by server with local (Exim 3.12 #1 (Debian)) id 159aJR-0007gl-00 for ; Mon, 11 Jun 2001 17:37:33 -0500 Date: Mon, 11 Jun 2001 17:37:33 -0500 From: will trillich To: pgsql-general@postgresql.org Subject: Re: ORDER BY what? Message-ID: <20010611173733.B29434@serensoft.com> Mail-Followup-To: pgsql-general@postgresql.org References: <01061111193103.29653@bugs> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <01061111193103.29653@bugs>; from martin@bugs.unl.edu.ar on Mon, Jun 11, 2001 at 11:19:31AM +0300 X-Archive-Number: 200106/393 X-Sequence-Number: 10738 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? 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... 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@serensoft.com http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!