There's more than one way to do things | |
PerlMonks |
OT: Generalizing SQL Select statementsby AidanLee (Chaplain) |
on Jan 16, 2002 at 03:59 UTC ( [id://139095]=perlquestion: print w/replies, xml ) | Need Help?? |
AidanLee has asked for the wisdom of the Perl Monks concerning the following question: For all of you who find their Perl programming touches on database access, I've a riddle that I have not yet managed to crack. I fear it may come to a compromise in the end, but I thought that after several unproductive hours pounding on this problem I'd see if the Monestary had any ideas. My application is an administrative web-interface for a client's web site. There are different types of objects that they can create, destroy, and relate to one another, be they pages, contacts, news articles, etc. I'm using the fairly standard method of showing the administrator a list of the same kind of objects, from which they click on one to update it (as well as a link to delete a given object or add a new one). The problem comes down to implementing this list page, which I've done several times in a number of different ways. Each time I reimplement this functionality I've found a slightly more generalized way (read: prefereable... so that a listing method is not directly tied to what kind of object is being listed) to make these lists. The snag I've run into is that to get the desired funcionality, my current methods are too slow when dealing with a few thousand objects. Consider the following schema (mysql):
Everything is a "Node" (pardon the borrowed vocabulary) including Contacts and ContactGroups. All relationships between nodes are drawn through the Nodes_Relationships table. Now, the listing of Contacts available for editing lists the Last and First Name, the Phone, Email and the Title of the ContactGroup the contact is a member of. The listing also has the following features:
I've currently got my application doing number two, above. The problem is that I've been asked to make the system faster, as it's beyond sluggish when dealing with the current data set of 3000-some-odd records. In my mind the solution is to have all the manipulation for searching and sorting done on the database and to return only the 30 records I want displayed. But seeing as I'm running mysql, the only two tools I see useful for this (stored procedures and subselects) aren't available to me. Do any other monks have an idea of how to speed the system up without sacrificing the aforementioned functionality? Please ask me to clarify anything that seems unclear, as it's all a rather large dilemma and I'm not sure I've managed to keep the whole thing in my head while writing this Edit: chipmunk 2002-01-15
Back to
Seekers of Perl Wisdom
|
|