Yes... The problem is my orange is not performing well, so I'm switching to an apple. The question is: which apple should I use?
The code, in this case, does (or rather will, if I go forward with it) indeed read from the database as that is how it will populate the data structure I am using. The point is, this "server" would be persistent. So each request would only need to execute the code I am timing (and to fetch any data not yet in its cache or which is "dirty".
I wanted to avoid getting into the SQL specifics, because I use some Postgres-specific stuff which is not immediately apparent. My query is something like:
SELECT count(*) as count,category.category,nlevel(category.category) A
+S level,
subpath(category.category,0,nlevel(category.category)-1) as parent,
category.head_title, category.cat_title, category.subcat_title FROM da
+ta, category
WHERE
data.category <@ category.category
GROUP BY category.category, category.head_title, category.cat_title, c
+ategory.subcat_title
The category table looks like:
Table "category"
Column | Type
--------------+-------------------
head_title | character varying
cat_title | character varying
subcat_title | character varying
category | ltree
The data table looks like:
Table "data"
Column | Type
+
+----------------------------------------------
id | integer
category | ltree[]
... there are other columns here but these are the ones relevant to the query.
- dEvNuL