X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6A3D7475FB0 for ; Fri, 7 Feb 2003 04:41:33 -0500 (EST) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by postgresql.org (Postfix) with ESMTP id 12EE8476257 for ; Fri, 7 Feb 2003 04:36:56 -0500 (EST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 18h4wK-0006nN-0d; Fri, 07 Feb 2003 09:36:56 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 25EE616B6B; Fri, 7 Feb 2003 09:36:55 +0000 (GMT) Received: from archonet.com (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with SMTP id 8869E16AF4; Fri, 7 Feb 2003 09:36:54 +0000 (GMT) Received: from 192.168.1.16 (SquirrelMail authenticated user dev) by mainbox.archonet.com with HTTP; Fri, 7 Feb 2003 09:36:54 -0000 (GMT) Message-ID: <1064.192.168.1.16.1044610614.squirrel@mainbox.archonet.com> In-Reply-To: <20030207080420.2131718332@cheetah.webtribe.net> References: <20030207080420.2131718332@cheetah.webtribe.net> Date: Fri, 7 Feb 2003 09:36:54 -0000 (GMT) Subject: Re: which will be faster? w/ or w/o indices From: dev@archonet.com To: val@webtribe.net Cc: pgsql-sql@postgresql.org X-Mailer: SquirrelMail (version 1.3.2) MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Priority: 3 Importance: Normal X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/144 X-Sequence-Number: 11542 > I understand that if you are importing data into the database > that this will go faster if there are no indices against the > target table. > > If I want to run this statement: > INSERT INTO table_a SELECT * from table_b WHERE value_1 BETWEEN > X AND Y; > is it best to do that with or without indices? Can't really say without testing - it'll depend on the size of the various tables, X and Y disk speeds etc. The only suggestion I can make is to try an EXPLAIN (Reference manual, SQL commands) with and without ENABLE_SEQSCAN off (Admin guide ch 3.2). - Richard Huxton