X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 91A375E46E7 for ; Thu, 26 Aug 2004 04:22:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32436-03 for ; Thu, 26 Aug 2004 07:22:05 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 03FD35E46C1 for ; Thu, 26 Aug 2004 04:22:03 -0300 (ADT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 30418EC1C4; Thu, 26 Aug 2004 08:23:39 +0200 (CEST) Received: from zoot.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 056DBEC15F; Thu, 26 Aug 2004 08:23:39 +0200 (CEST) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: pgsql-performance@postgresql.org Subject: Re: TSearch2 and optimisation ... Date: Thu, 26 Aug 2004 09:22:01 +0200 User-Agent: KMail/1.6.2 Cc: Josh Berkus , =?iso-8859-15?q?Herv=E9_Piedvache?= References: <200408260048.32274.footcow@noos.fr> <200408251650.53233.josh@agliodbs.com> In-Reply-To: <200408251650.53233.josh@agliodbs.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Message-Id: <200408260922.01797.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/356 X-Sequence-Number: 7992 Josh, Le Jeudi 26 Août 2004 01:50, Josh Berkus a écrit : > > The request takes about 4 seconds ... I have about 1 400 000 records in > > article and 36 000 records in site table ... it's a Bi-Pentium III 933 > > MHz server with 1 Gb memory ... I'm using Postgresql 7.4.5 > > For me this result is very very slow I really need a quicker result with > > less than 1 second ... > > The next time I call the same request I have got the result in 439 ms ... > > but If I replace "Postgresql" in my find with "Linux" for example I will > > get the next result in 5 seconds ... :o( > > Hmmm. It sounds like your system is unable to keep all of the data cached > in memory. What else do you have going on on that machine? There is an Apache + PHP running in same time ... > > Explain gives me this result : > > Please do "EXPLAIN ANALYZE" so that we can see where time is actually > spent. QUERY PLAN --------------------------------------------------------------------------------------------------------------------------- Sort (cost=10740.35..10743.73 rows=1351 width=190) (actual time=7054.603..7054.707 rows=139 loops=1) Sort Key: rank(a.idxfti, '\'postgresql\''::tsquery), a.r_date -> Merge Join (cost=4123.09..10670.10 rows=1351 width=190) (actual time=5476.749..7052.766 rows=139 loops=1) Merge Cond: ("outer".id_site = "inner".id_site) -> Index Scan using site_id_site_key on site s (cost=0.00..2846.52 rows=35705 width=28) (actual time=43.985..1548.903 rows=34897 loops=1) -> Sort (cost=4123.09..4126.47 rows=1351 width=166) (actual time=5416.836..5416.983 rows=139 loops=1) Sort Key: a.id_site -> Index Scan using idxfti_idx on article a (cost=0.00..4052.84 rows=1351 width=166) (actual time=109.766..5415.108 rows=139 loops=1) Index Cond: (idxfti @@ '\'postgresql\''::tsquery) Filter: (idxfti @@ '\'postgresql\''::tsquery) SubPlan -> Seq Scan on user_choice u (cost=0.00..2.69 rows=1 width=4) (actual time=0.146..0.146 rows=0 loops=139) Filter: ((id_site = $0) AND (id_user = 1)) Total runtime: 7056.126 ms Thanks for your help ... -- Hervé Piedvache Elma Ingénierie Informatique 6 rue du Faubourg Saint-Honoré F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902