Hi, thanks a lot for the helpful replies.
Sorry to bother again, but there is still something that hasn't been
answered.
Simon Slavin-3 has addressed my question but not exactly what I was asking.
Suppose I have two tables "movies" and "people" and other tables to relate
both tables:
You have:
CREATE TABLE movies(movie_id INTEGER, title TEXT, unique(movie_id));
CREATE TABLE tags(movie_id INTEGER, tag TEXT, unique(movie_id,tag));
You can solve your problem, using pure SQL. No need to resort to the
application layer. Just execute the SQL transaction below. It takes care of
On 7 Feb 2011, at 11:19pm, Yuzem wrote:
> One more thing:
> I have the tables "movies" and "people"
> Those two tables are related by tables "directors", "writers", etc...
> movies: id, title
> people: id, name
>
> directors: movieId, peopleId
> writers: movieId, peopleId
> etc...
>
> How can
Ok, thanks all for your answers, I guest I will have to normalize the
database and explore the foreign key feature.
One more thing:
I have the tables "movies" and "people"
Those two tables are related by tables "directors", "writers", etc...
movies: id, title
people: id, name
directors:
2 0 tags 00
> 21 Goto 0 5 0 00
>
> Michael D. Black
> Senior Scientist
> NG Information Systems
> Advanced Analytics Directorate
>
>
>
>
> From: sqlite-users-boun..
Directorate
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on
behalf of Yuzem [naujnit...@gmail.com]
Sent: Monday, February 07, 2011 2:13 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] EXT : Speed up count(distinct col)
Bl
Yuzem wrote:
> >
> > Test#1
> > create index tags_index on tags(tag);
> > You should have an index for any fields you query on like this.
> >
>
> Thanks Michael but I don't see any speed improvement:
> create index test on tags(tag);
> select count(distinct tag) from tags;
>
> This is much
Black, Michael (IS) wrote:
>
> Test#1
> create index tags_index on tags(tag);
> You should have an index for any fields you query on like this.
>
Thanks Michael but I don't see any speed improvement:
create index test on tags(tag);
select count(distinct tag) from tags;
This is much faster:
Test#1
create index tags_index on tags(tag);
You should have an index for any fields you query on like this.
Test#2
Normalize your tags into a separate table so you then store the rowid in your
tags table instead of the string. Your compares will be notably faster using
integers rather than
9 matches
Mail list logo