[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to use SQLite (sqlite3) more efficiently

On Thu, Jun 5, 2014 at 1:35 PM, Demian Brecht <demianbrecht at gmail.com> 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.