The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

db usage issues

:Issue #1:
Sometimes I need to execute SQL on my database and execute more SQL on the results that I got from the first SQL. I don't know how to do this, so I end up tweaking the database or come up with some other solution. Is this the result of bad database design? Are there ways to avoid this? Or if it is ok design, how can I implement this?

:Issue #2:
I use sqlite as my db engine. In addition to user data, I also store lookup tables in a database. The issue is that db accesses are rather slow, so I end up reading the lookup tables into memory and access them that way (pass a pointer to the lookup table to the parts of the code that need it, when they need it). Is this common experience or am I doing something wrong that results in slow db access?
There is nothing special going on. Simple tables.. I generally use the db table as an array replacement.

I think reading everything as string from the sqlite database and then converting to long/int/double is not helping either..
Tuesday, March 27, 2007
Generally, this is a result of you not being very experienced with SQL (your sig does say rookie_db_coder, so I'm making that assumption).  You'll get better, there is a lot to learn.

BTW, if you are redesigning the database to make less queries, and you aren't very experienced with SQL, then there is a good chance you are trashing the database design.

Also, the lookup tables should be lightning fast.  If they are causing a performance problem, something is very wrong.  Could you post some sample code?
JSmith Send private email
Tuesday, March 27, 2007
There is a great newsgroup for SQLite where rookies ask for help (and get it) all the time ( -- the link is there on the front page I believe).  It is a very active and helpful group.

I use SQLite in my apps and it's very fast.  One tiny hint: Make sure you are using an index (appropriately) because that can make all the difference in the world.
Wednesday, March 28, 2007

Thanks for the suggestion. I should have gone there first. Sorry.

Wednesday, March 28, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz