Tim Arnold wrote:

> This is a question about system design I guess. I have a django
> website that allows users to change/view configuration details for
> documentation builds. The database is very small. The reason I'm using
> a database in the first place is to make it easy for users to change
> the configuration of their builds. Django makes that easy and I can go
> on to other problems, like actually building the documentation.
>
> During a build, I query the configuration database at different times
> to get the configuration I need, which results in several calls to the
> database at different points of the build process.
>
> It doesn't feel right that I'm making these calls at different times.
> I *could* make a single big call at the beginning of the build,
> basically serializing all the config data I could need into a
> dictionary or maybe a json structure. And just pass that structure
> around as needed during the build, with no more database calls needed.
>
> These builds take from a few minutes to an hour or so, with the time
> spent making db calls almost insignificant. So if time isn't a
> problem, am I wringing my hands over something that really doesn't
> matter much? I guess it just doesn't feel like the right thing to me.
>
> thanks,
> --Tim

Hello Tim,

Given the times that you've quoted for the documentation builds, a few 
microseconds here and there for database queries doesn't really matter.

The Django docs, as it happens, look favourably on doing one query up
front,
(http://docs.djangoproject.com/en/1.1/topics/db/optimization/#topics-db-optimization),
but they also recommend profiling first, which would presumably
highlight the insignificance of your queries compared with the duration
of the builds.

So I think the upshot is don't worry about it, or if you must,
accept that you're worrying more about aesthetics than anything else
(not that aesthetics aren't important).

Cheers,

Kev


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to