Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'indexes': 0.09; 'sql,': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'assume': 0.14; 'programs.': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sqlite': 0.16; 'subject:sqlite3': 0.16; 'url:sqlite': 0.16; 'index': 0.16; 'wrote:': 0.18; 'normally': 0.19; 'thu,': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'primary': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'subject:) ': 0.29; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'breaking': 0.31; 'another': 0.32; 'table': 0.34; "i'd": 0.34; 'subject: (': 0.35; 'info': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'indexed': 0.36; 'url:org': 0.36; 'pm,': 0.38; 'expensive': 0.39; 'field.': 0.61; 'full': 0.61; 'new': 0.61; "you're": 0.61; "you'll": 0.62; 'name': 0.63; 'field': 0.63; 'subject:more': 0.64; 'more': 0.64; 'obvious': 0.74; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=sPnRqVsUG1Dgf1+N0KOIQfkWQSDtVrpU2vrMhIX9oWY=; b=dYTp5c4hVODjLCVSu0pREHHaLtzYNLVqfZdx46BgFfqWjQQFdC9+TY3jl9NZxQ/GDE E+qcaBQ1nU/jKS+nw9ek03vx2Pa7CbW6JlINwWyY00f/0C1UXuOFQkdn4vCt5F1IFOp1 wETm/Jv8O0lpdwC0RMF4jZTIwReU2wzZk1i7RE667PtKStkTnDZIuTWYxDwZl7NJ41iZ qEHwdiGVKmJlSbfPopGv98CnQ22aRffmzutjuCcvxPZ2/DW8pWOKaDKpr/NDRK0hkDZM JRMX2Pi1GMPNBtSNhAtefp8NFqER7EX1LblcXwGYfnnQ4iwE5P5khwJamVzRcvkyG+Ta 7jmw== MIME-Version: 1.0 X-Received: by 10.58.160.134 with SMTP id xk6mr180440veb.64.1401952095851; Thu, 05 Jun 2014 00:08:15 -0700 (PDT) In-Reply-To: References: <6e18a509-9471-4fe8-8664-3c58fc17536f@googlegroups.com> <87670ef0-7493-4c1d-96c9-753b0f759723@googlegroups.com> Date: Thu, 5 Jun 2014 17:08:15 +1000 Subject: Re: How to use SQLite (sqlite3) more efficiently From: Chris Angelico Cc: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401952098 news.xs4all.nl 2881 [2001:888:2000:d::a6]:37414 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72683 On Thu, Jun 5, 2014 at 1:35 PM, Demian Brecht wrote: >> > On Thu, Jun 5, 2014 at 6:27 AM, ps16thypresence wrote: >> >> > > I'm completely new to SQL, and recently started using SQLite in >> > > one of my Python programs. > > Unrelated to Python but as you're new to SQL I figured I'd ask: Do you have > an index on the name field? If you don't, you'll incur a full table scan > which will be more expensive than if you have an index in the field. > > For more info about indexes see http://www.sqlite.org/lang_createindex.html. It's the primary key, which I would normally assume is indexed implicitly. This is another reason for not breaking the CREATE TABLE statement at the point where the OP did; it's not obvious that that field is indexed, this way. ChrisA