P
Piet L.
I'm dealing with some performance problems.
I work with a hudge database (mysql) and have to perform queries on
it, depending of the parameters that the users give.
The intention is to build a real time website, automatically generated
according to the wishes of the users.
To illustrate the problem:
- here is an exctracting out of the database:
BOOK
book_id
title
publication_date
BOOK_AUTHOR
book_id
person_id
LIST_AUTHORS
person_id
name
firstname
email
- here is an example of the query I execute:
" show all the books written by author 124"
(Remark: a book can have more than one author
So I want something like:
book_title 1
author1_name, author2_name
book_title 2
author3_name, author1_name, author3_name, author4_name
)
The query is:
"SELECT b.*, ba.* from book b, book_author ba
LEFT JOIN list_authors l
ON ba.person_id = l.person_id
WHERE b.book_id = ba.book_id
AND ba.person_id = 124"
- I use XML::HANDLER::YAWRITER to write the result to a file
my $handler = XML::Handler::YAWriter->new(AsFile => "books.xml");
my $generator = XML::Generator:
BI->new(
Handler => $handler,
dbh => $dbh
);
- Then I use xslt to transform it to html, I do this as follows:
my $xslt = XML::XSLT->new ("./books.xsl");
print $xslt->serve("./books.xml");
The problem is thus that this takes (some) minutes to execute all of
this (even if there are a few records as result),
I think the problem is with the JOIN, but I am not sure.
Can someone help me out,
I am not using the write modules,
is my structure not good for what I want to accomplish?
Are there any good books/tutorials/examples on the internet for
generating such an automatic site?
Also a question extra, Should I use CGI or isn't this neccessary?
THanks
PL.
I work with a hudge database (mysql) and have to perform queries on
it, depending of the parameters that the users give.
The intention is to build a real time website, automatically generated
according to the wishes of the users.
To illustrate the problem:
- here is an exctracting out of the database:
BOOK
book_id
title
publication_date
BOOK_AUTHOR
book_id
person_id
LIST_AUTHORS
person_id
name
firstname
- here is an example of the query I execute:
" show all the books written by author 124"
(Remark: a book can have more than one author
So I want something like:
book_title 1
author1_name, author2_name
book_title 2
author3_name, author1_name, author3_name, author4_name
)
The query is:
"SELECT b.*, ba.* from book b, book_author ba
LEFT JOIN list_authors l
ON ba.person_id = l.person_id
WHERE b.book_id = ba.book_id
AND ba.person_id = 124"
- I use XML::HANDLER::YAWRITER to write the result to a file
my $handler = XML::Handler::YAWriter->new(AsFile => "books.xml");
my $generator = XML::Generator:
Handler => $handler,
dbh => $dbh
);
- Then I use xslt to transform it to html, I do this as follows:
my $xslt = XML::XSLT->new ("./books.xsl");
print $xslt->serve("./books.xml");
The problem is thus that this takes (some) minutes to execute all of
this (even if there are a few records as result),
I think the problem is with the JOIN, but I am not sure.
Can someone help me out,
I am not using the write modules,
is my structure not good for what I want to accomplish?
Are there any good books/tutorials/examples on the internet for
generating such an automatic site?
Also a question extra, Should I use CGI or isn't this neccessary?
THanks
PL.