>> B) By insisting on your email values being unique you have already
required SQLite to make up an index for the column. SQLite needs that index
so that when you do an INSERT it can quickly check to see that the value
you use doesn't already exist.
Agreed. I was just asking the general space requirements for indexing a
column.
So as mentioned in the earlier email, it is equivalent to the space of the
cell + a few additional bytes. Lets say I have a column with all rows
having a md5sum.
I wanted to create an INDEX (not unique) of the md5sum column. Would the
index also eat up 20 Bytes or more than that ?



On Wed, Oct 30, 2013 at 3:15 PM, Simon Slavin <slav...@bigfraud.org> wrote:

>
> On 30 Oct 2013, at 8:37am, Raheel Gupta <raheel...@gmail.com> wrote:
>
> > email VARCHAR(255) UNIQUE NOT NULL
> > }
> >
> > I wanted to know if I create an INDEX for the column "email" what isg
> going
> > to be the extra space the index will occupy ?
>
> Two things:
>
> A) SQLite interprets "VARCHAR(255)" as "TEXT".  Each value does not take
> up 255 bytes of space.  The amount of space taken up varies with the length
> of the value.
>
> B) By insisting on your email values being unique you have already
> required SQLite to make up an index for the column.  SQLite needs that
> index so that when you do an INSERT it can quickly check to see that the
> value you use doesn't already exist.
>
> So creating another index on the same thing would just be a waste of space.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to