+ Reply to Thread
Results 1 to 4 of 4

Thread: Multi Dimensional Arrays?

  1. #1
    Barn Frequenter icoombs will become famous soon enough icoombs's Avatar
    Join Date
    Jul 2008
    Location
    Hayes, Middlesex, UK
    Posts
    151
    Real Name
    Ian Coombs
    Rep Power
    4

    Multi Dimensional Arrays?

    Hi All

    I'm looking at a project that uses a lot of MS SQL database interaction and i am a bit concerned about the speed of delivering pages when querying a database table that is approaching 1.2 million records. This project is for an Internet Radio station and currently the only option i see is running the query each time the page refreshes, which happens at about the same time for all users viewing the stations now playing page.

    I'm looking into ways to reduce the load on the server by keeping some of the frequently required information in Application Variable which would be created from arrays, so effectively using Application Arrays, I would like your thoughts on this method and weather there would be any speed advantages to doing it this way.

    Let me explain a bit more..

    The page has 4 main areas, Now Playing, History (Last ten tracks played), This weeks Chart (top 10) and All Time Top Ten. I am proposing to hold the last 3 areas in the Application Variables, History and the two top tens.

    Now the All time top ten is fairly static just minor changes once in a while, usually just adding new requested times value and occasionally one will move up a place like you would expect in a chart.

    The weekly top ten is about the same but more frequently

    The history list updates each time a track finishes and with this one i will need to remove the first array item and add one at the end. This gives me one of my current questions, can the array be renumbered so it always begins array(0) when i remove the contents of array(0) or would i need to shuffle all the other items to fill array(0)?

    If anyone has a better suggestion i am currently in the thinking and experimenting stage so am open to any ideas at the moment.

    Regards
    Ian

  2. #2
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Here's a couple of things to try out.

    First make double dog sure that your main table has a primary key is a indexed. Queries against the PK should go fairly quickly and 1.2 million records is not huge -- at last compared to some of the tables I've worked against (10 million plus).

    Then, for your two lists that don't change all that often, create two lookup tables, one for each, that just contains a Foreign Key that points to the PK on the main table. The join query should run fairly quickly so long as the indexs are used (the PK on these lookup tables would be 1-10 to set the order).

    For the most recently played list, consider creating a separate table of the 10 records from the main table -- this is a good enough reason to violate the "don't store duplicate data" rule. Then, just update this table to add the most recent record and delete the 11th oldest record as necessary.

    You could also try the same idea as the Top 10 lists -- which should probably perform OK.

    Of course, do some load testing, but I'm thinking the above should perform OK.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  3. #3
    Barn Frequenter icoombs will become famous soon enough icoombs's Avatar
    Join Date
    Jul 2008
    Location
    Hayes, Middlesex, UK
    Posts
    151
    Real Name
    Ian Coombs
    Rep Power
    4

    Thanks for the reply Wolffy.

    The only problem i have there is they all sound like changes in the database and the client (so to speak) is saying i cant make changes in the database as it is created and managed by the broadcast software.

    I had already suggested creating a separate table to contain the history list but he is nervous about any thing being done in the actual database as it is used for reporting to the music industry for licencing and royalties. And apparently the software seems to get reinstalled regularly as the writers are constantly doing updates to fix bugs.

    Also i am a complete novice with MS SQL so have been unable to convince him that changes wont cause problems if the software is reinstalled.

    I am currently working on a theory of having the page create static elements of the relevant bits when the first browser refreshes then all subsequent browser refreshes will load the static page elements. I am still running tests making the second browsers to wait while the first refresher generates the elements but i think it will work using an application lock.

    The main aim is to stop the listeners complaining that when the track changes they get errors on their browsers as it takes so long for the page to be generated, hence i came up with the static element option so the queries and code would only run once per track change.

    Thanks again for the suggestions, i will look into the indexing to make sure the queries are executed as quickly as possible.

  4. #4
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    I recommend looking into using a disconnected recordset: 4GuysFromRolla.com - Using Disconnected Recordsets
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread

Similar Threads

  1. ASP [multi table insert and update]
    By ocm1 in forum ASP Development
    Replies: 1
    Last Post: December 22nd, 2009, 10:44 AM
  2. multi-language database?
    By Ian in forum Microsoft Access
    Replies: 5
    Last Post: August 12th, 2009, 04:10 PM
  3. Multi folder web app
    By micky in forum .NET Development
    Replies: 24
    Last Post: July 9th, 2009, 10:40 AM
  4. Syntax Error with Arrays
    By BLaaaaaaaaaarche in forum ASP Development
    Replies: 4
    Last Post: August 18th, 2008, 04:14 PM
  5. Multi Prints with Watermarks
    By AOG123 in forum Microsoft Access
    Replies: 1
    Last Post: July 9th, 2008, 10:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO