X-Original-To: pgsql-sql@postgresql.org Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id B450A475C15 for ; Mon, 10 Mar 2003 12:12:55 -0500 (EST) Received: from klaster.net (pa88.krakow.cvx.ppp.tpnet.pl [213.76.36.88]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 68BF02BDDF; Mon, 10 Mar 2003 18:10:11 +0100 (CET) Message-ID: <3E6CC7C4.5050908@klaster.net> Date: Mon, 10 Mar 2003 18:13:40 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; PL; rv:1.1) Gecko/20020826 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Objectz Cc: pgsql-sql@postgresql.org Subject: Re: Execution plan Question References: <002201c2e724$2816d8a0$aea067d4@eg1opwxp107> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/247 X-Sequence-Number: 12287 Objectz wrote: > hi all, > > I have a strange problem and really wish to get some help in here. > > I have the following tables > > create table shr_objects( > objectid int8 not null > companyid int4 not null > name varchar(255) > description varchar(255) > ) > primary key : object id > foreign key on companyid references shr_companies(companyid) > Index on companyid > Number of rows ~ 1,410,000 > > create table smb_contacts{ > contactid int4 not null > objectid int8 not null > firstname varchar(255) > lastname varchar(255) > ) > primary key : contactid > foreign key on objectid references shr_objects9objectid) > index on : objectid > Number of rows ~ 10,000 > > I am trying to execute a query that joins the 2 tables on object id , it > works fine but when i add an order clause the performance is degarded > dramatically. I have included both quiries with their excution plan. > > Regards, > --ObjectZ Maker Well, it looks like you didn't include neither queries nor there execution plan. Don't forget to vacuum analyze before explain analyze your queries. Anyway, how many rows do you want to be sorted? Regards, Tomasz Myrta