Forums

This topic is locked

Improve SQL

Posted 16 Jan 2005 23:39:26
1
has voted
16 Jan 2005 23:39:26 Ole Wegard Utne posted:
Hi there: I'm currently developing a portal. As I am more of a graphics designer than a programmer I use lots of "cheats" and examples to work my way around obstacles that occure. For now I have two questions and apreciate all the help I can get (starting to get a bit frustrated and codeblind here) well...
Specs: IIS running on a p43400 with 2GB ram (no capacityprob), access2000 DB and pages developed in DMX
1) On my detail page this RS is running very slooooooooow and I was wondering if there is a way to improve it:
SELECT *
FROM lost, objectCategory, Poststed, lostType
WHERE lostID = MMColParam AND lost.catID LIKE objectCategory.CatID AND lost.lostWhere LIKE Poststed.postnr
(of course there is the variable MMColParam | 1 | Request.QueryString("lostID" to filter)

2) this RS returns a specific record of a specific category. I tried all over to find a suitable COUNT method that returns the total number of objects from the category that MMColParam variable returned

By the way thanks for a brilliant website <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Replies

Replied 17 Jan 2005 02:27:36
17 Jan 2005 02:27:36 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>...access2000 DB and pages developed in DMX
1) On my detail page this RS is running very slooooooooow and I was wondering if there is a way to improve it:
SELECT *
FROM lost, objectCategory, Poststed, lostType
WHERE lostID = MMColParam AND lost.catID LIKE objectCategory.CatID AND lost.lostWhere LIKE Poststed.postnr
(of course there is the variable MMColParam | 1 | Request.QueryString("lostID" to filter)...<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
How many columns/fields are you returning in the Recordset? Generally, how many records are being returned too?

Also, is the server hosted in an office or at a host facility?

Edited by - ccharlton on 17 Jan 2005 02:28:01
Replied 17 Jan 2005 11:34:57
17 Jan 2005 11:34:57 Ole Wegard Utne replied:
Hi Chris
The RS returnes values from 20 columns, but I dont present everyone of them on my page they are just the result of relations due to my need to present Lettered values rather than numbers if you get my point.
About the computer; it is my personal so it is not a question about heavy traffic. When the site is up and running I guess I'l have to pay for what ever capacity I need.....
Thanks for your qucik reply btw <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 17 Jan 2005 20:23:52
17 Jan 2005 20:23:52 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>The RS returnes values from 20 columns, but I dont present everyone of them on my page they are just the result of relations due to my need to present Lettered values rather than numbers if you get my point.
About the computer; it is my personal so it is not a question about heavy traffic. When the site is up and running I guess I'l have to pay for what ever capacity I need.....<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
The SQL query doesn't seem heavy, but then again I'm not sure what data is beign pulled down. I'd look at your page and see if any CSS/styles & JavaScript code can be externalized (to trim the page), and above that I'd make sure you don't have any extra Recordsets unneeded, etc.etc.
Replied 17 Jan 2005 21:15:35
17 Jan 2005 21:15:35 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>...On my detail page this RS is running very slooooooooow and I was wondering if there is a way to improve it:
<pre id=code><font face=courier size=2 id=code>SELECT *
FROM lost, objectCategory, Poststed, lostType
WHERE lostID = MMColParam AND lost.catID LIKE objectCategory.CatID AND lost.lostWhere LIKE Poststed.postnr</font id=code></pre id=code>
(of course there is the variable MMColParam | 1 | Request.QueryString("lostID" to filter)<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Is this the only SQL code (Recordset) on the page?

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>...this RS returns a specific record of a specific category. I tried all over to find a suitable COUNT method that returns the total number of objects from the category that MMColParam variable returned<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Can you post this SQL too? Is this on the same page?

Also, are you using a lot of tables on your page? Do you have a live link to review?
Replied 17 Jan 2005 23:29:55
17 Jan 2005 23:29:55 Ole Wegard Utne replied:
Hi again!
Well it seems that I found the solution by revising my SQL with some more coffee consumed..hehe..
The darn thing ran a whole lot better with the use of = instead of LIKE at this point:
Problem: ..........AND lost.catID LIKE objectCategory.CatID
Solution: ..........AND lost.catID = objectCategory.CatID

sorry to bother you with this trivial(?) case, and thank you for your interest in helping me!

(still need some help with that count thing though)
-ole wegard

Edited by - owu on 17 Jan 2005 23:33:44
Replied 18 Jan 2005 07:14:26
18 Jan 2005 07:14:26 Chris Charlton replied:
Cool! Don't shy from asking, every question is <i>just</i> that, a question.

<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic