Re: Page loading slowly with recordsets - still (doing my head in now!)
am 04.11.2004 15:11:37 von ten.xocIn addition to Bob's comments, you might think about posting a link like
this for people who might have a boss looking over their shoulder.
I didn't stay on it long enough, so I'm not sure how kosher the content
really is, but if I saw one of my underlings looking at this page, it would
certainly raise an eyebrow.
A
"Greg"
news:uNNIoBmwEHA.1404@TK2MSFTNGP11.phx.gbl...
> My page is retrieving recordsets REALLY slowly and it's doing my nut in
now!
>
> I've attached all the code to this post in the hope that someone might
find
> a problem with it. Because I'm close to giving up! The queries run really
> quick in Access, and my only idea now is that it's got something to do
with
> the server I'm running it on - which I don't have access to.
>
> The last time I loaded the page it took one second to connect to the
> database with this:
> conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=C:\inetpub\clients\awt326\db\db127\store.mdb"
> set con = Server.CreateObject("ADODB.Connection")
> con.open(conString)
>
> It took another second to open the cat recordset using:
> sqlString = "SELECT * FROM [categories] Order By [Position]"
> set cat = con.Execute(sqlString,,1)
>
> It took a further second to open the welcome recordset using:
> sqlString = "SELECT * FROM [welcome] WHERE [Key] = 1"
> set welcome = con.Execute(sqlString,,1)
>
> Then another second for this one:
> sqlString = "SELECT * FROM [featured] Order By [Key]"
> set featured = con.Execute(sqlString,,1)
>
> And another second for this one:
> sqlString = "SELECT * FROM [topten] Order By [Position]"
> set topten = con.Execute(sqlString,,1)
>
> So I'm stuck! All these queries run really quickly when I run them in
> access! I don't get it! It's happening on all the pages of the site, not
> just this one, everytime it gets a recordset it either does it really
quick,
> or really slowly. I'm confused to the max!
>
> Another killer was that it took 2 seconds to actually write the featured
> items to the screen! So I think this section might need optimising a
> little - though at the moment I can't think of a better way of doing it!
I'm
> talking about lines 234 to 368.
>
> All together the entire page took 7 seconds to load - that's just not
> natural is it?! I can't be doing anything else wrong can I?! After
> implementing everyones ideas from this forum I've got the loading time for
> the whole page from 12 seconds down to 7 :-D
>
> Amongst other things....
> I've changed the connection string to use MS Jet 4.0
> I've opened the recordsets only when they're needed so I only have one
open
> at once.
> I've removed interleaved HTML and ASP segments and used Response.Write
> instead.
> I've changed the way I open a RecordSet (millions of times!)
> I even stopped using Server.MapPath() when connecting to the database
> because I heard this take a little time.
>
> You can see the page "in action" at this address www.jmswebdesigns.com/127
> and the source is attached to this post.
>
> Oh and a big thank you to Bob Barrows who gave me loads of help!
>
> Kind regards,
> Greg
>
>
>