I'm a newbie to using SQL in general, so my apologies if this has been
answered before.

I have a series of tables I'd like to create to represents the output
that comes from parsing a bunch of source code files. Basically ctags
output in DB format.

I've created the following tables using sqlite3

CREATE TABLE Types (
       TypeID INTEGER PRIMARY KEY
     , TypeInfo CHAR(125)
);

CREATE TABLE Templates (
       TemplateID INTEGER PRIMARY KEY
     , TemplateSignature CHAR(125)
);

CREATE TABLE Files (
       FileID INTEGER PRIMARY KEY
     , Path CHAR(255)
);

CREATE TABLE Symbols (
       Id INTEGER PRIMARY KEY
     , Kind INTEGER
     , Name CHAR(125)
     , FileID INTEGER
     , TypeID INTEGER
     , Offset INTEGER
     , LineNumber INTEGER
     , TemplateID INTEGER DEFAULT 0 NOT NULL
     , Parent INTEGER DEFAULT 0
);

CREATE TABLE Functions (
       FuncID INTEGER PRIMARY KEY
     , Signature CHAR(125)
     , SymbolID INTEGER
     , ReturnTypeID INTEGER NOT NULL
);


I can then populate the tables fine. In my test, the symbols table had
over 11,000 entries and the functions table over 7,200 entries.

When I run the following query:
"select symbols.name, functions.signature from symbols, functions
where functions.symbolid = symbols.id;"

This takes a long time (over 20 secs) on a P4 3 Ghz with 1 Gb RAM.
Should it take this long? Is it slow because my table is setup
incorrectly?

Thanks so much!

Jim Crafton

Reply via email to