X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 44F8111F6067 for ; Fri, 28 Apr 2006 08:31:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 45008-06 for ; Fri, 28 Apr 2006 08:31:01 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web51009.mail.yahoo.com (web51009.mail.yahoo.com [206.190.39.128]) by postgresql.org (Postfix) with SMTP id A7BD811F6004 for ; Fri, 28 Apr 2006 08:30:59 -0300 (ADT) Received: (qmail 57109 invoked by uid 60001); 28 Apr 2006 11:30:59 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=wYl1Pf9Y1rC/oO+G9z3njiQtb1+8jkaDsuZ9YRIb2ovEQhG8VwX3XgT52I1EjPNvonB4NiKM/3r8O+nLZvtKD7XaKbiTzdfDuWf5uyiZ9YSr8eC/MT1bT2zErlQ+oC8uXK4V/6i148PMuw7Dx8oP6QxEWndt1nq7VzbRiXiEETg= ; Message-ID: <20060428113059.57107.qmail@web51009.mail.yahoo.com> Received: from [193.140.92.26] by web51009.mail.yahoo.com via HTTP; Fri, 28 Apr 2006 04:30:59 PDT Date: Fri, 28 Apr 2006 04:30:59 -0700 (PDT) From: gulsah Subject: query performance question To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-157778718-1146223859=:52971" Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/668 X-Sequence-Number: 18752 --0-157778718-1146223859=:52971 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, I have a performance problem with Postgresql version 8.1 installed on a Fedora Core release 4 (Stentz) with kernel version 2.6.11. The machine I am working on has 512MB of RAM and Pentium III 800 MHz CPU. I have only one table in the database which consists of 256 columns and 10000 rows. Each column is of float type and each row corresponds to a vector in my application. What I want to do is to compute the distance between a predefined vector in hand and the ones in the database. The computation proceeds according to the following pseudocode: for(i=1; i<=256 ; i++){ distance += abs(x1_i - x2_i); } where x1_i denotes the vector in hand's i coordinate and x2_i denotes the i coordinate of the vector in the database. The distance computation have to be done for all the vectors in the database by means of a query and the result set should be sorted in terms of the computed distances. When I implement the query and measure the time spent for it in an application I see that the query is handled in more than 8 seconds which is undesirable in my application. Here what I want to ask you all is that, is it a normal performance for a computer with the properties that I have mentioned above? Is there any solution in your mind to increase the performance of my query? To make it more undestandable, I should give the query for vectors with size 3, but in my case their size is 256. select id as vectorid, abs(40.9546-x2_1)+abs(-72.9964-x2_2)+abs(53.5348-x2_3) as distance from vectordb order by distance Thank you all for your help. - gulsah --------------------------------- Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. --0-157778718-1146223859=:52971 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi,

I have a performance problem with Postgresql version 8.1 installed on a Fedora Core release 4 (Stentz) with kernel version 2.6.11.

The machine I am working on has 512MB of RAM and Pentium III 800 MHz CPU.

I have only one table in the database which consists of 256 columns and 10000 rows. Each column is of float type and each row corresponds to a vector in my application. What I want to do is to compute the distance between a predefined vector in hand and the ones in the database.

The computation proceeds according to the following pseudocode:

        for(i=1; i<=256 ; i++){
                distance += abs(x1_i - x2_i);
        }

where x1_i denotes the vector in hand's i coordinate and x2_i denotes the i
coordinate of the vector in the database.

The distance computation have to be done for all the vectors in the database
by means of a query and the result set should be sorted in terms of the
computed distances.

When I implement the query and measure the time spent for it in an application
I see that the query is handled in more than 8 seconds which is undesirable in
my application.

Here what I want to ask you all is that, is it a normal performance for a
computer with the properties that I have mentioned above? Is there any solution
in your mind to increase the performance of my query?

To make it more undestandable, I should give the query for vectors with size
3, but in my case their size is 256.

select
id as vectorid,
abs(40.9546-x2_1)+abs(-72.9964-x2_2)+abs(53.5348-x2_3) as distance
from vectordb
order by distance

Thank you all for your help.


-
gulsah


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. --0-157778718-1146223859=:52971--