X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 92FF5DB00B for ; Thu, 27 Oct 2005 00:00:20 -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 17760-03 for ; Thu, 27 Oct 2005 03:00:17 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id A6FA3DB00C for ; Thu, 27 Oct 2005 00:00:16 -0300 (ADT) Received: by flake.decibel.org (Postfix, from userid 1001) id A475D15231; Wed, 26 Oct 2005 22:00:13 -0500 (CDT) Date: Wed, 26 Oct 2005 22:00:13 -0500 From: "Jim C. Nasby" To: Sidar L?pez Cruz Cc: pgsql-performance@postgresql.org Subject: Re: performance on query Message-ID: <20051027030013.GE16682@pervasive.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 required=5 tests=[AWL=0.008] X-Spam-Level: X-Archive-Number: 200510/410 X-Sequence-Number: 15178 So the issue is that instead of taking 174 seconds the query now takes 201? I'm guessing that SQL server might be using index covering, but that's just a guess. Posting query plans (prefferably with actual timing info; EXPLAIN ANALYZE on PostgreSQL and whatever the equivalent would be for MSSQL) might give us some idea. On Wed, Oct 26, 2005 at 05:47:31PM -0600, Sidar L?pez Cruz wrote: > I DON'T KNOW WHAT TO DO WITH THIS QUERYS... > Comparation with sql server, sql server wins !!! > > > Table sizes: > archivos: 40MB > fotos: 55MB > > select count(1) from fotos f where not exists (select a.archivo from > archivos a where a.archivo=f.archivo) > 173713 ms. > 110217 ms. > 83122 ms. > > select count(*) from > ( > select archivo from fotos > except > select archivo from archivos > ) x; > 201479 ms. > > SELECT count(*) > FROM fotos f > LEFT JOIN archivos a USING(archivo) > WHERE a.archivo IS NULL > 199523 ms. > > _________________________________________________________________ > MSN Amor: busca tu ? naranja http://latam.msn.com/amor/ > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461