• Hi dani_17

    quote:


    I have made I site in asp.net of used cars in the dominican republic. The site is quite successfull and in the 3rd month I have about 1,500 visitors per day and at least I cover expenses 😛


    Congratulations!

    quote:


    id(int) - id of the car.

    hits(decimal)- the number of visits the car had.

    hitdate(smalldatetime) - the date of the hits.

    So when a user views a car, if there is a row with that car and that date, it only updates the hits + 1. If in that day nobody visited the car, then I insert a new row with that date and hits=1.


    because nobody can hit a page 1.5 times a day, it might be worth considering changing hits to an integer field. Would also save some disk space.

    In each page I also show the visits. then I call a stored procedure that gives me:

    quote:


    Well, getting that 2 hit counters is getting me up to 5-6 seconds lag in the page processing. I already figured that changing the hits column from numeric to decimal makes the SUM() aggregate function to be a lot faster. I don't know how indexes work or what else I can do to improve the speed of the sum select, it's the only thing making my site slow.

    The table were I have this problem has 309,100 rows right now. Is that too much?


    This is definitely not too much records. A good starting point might be to run your query or stored procedure VIA QA with and use Query -> Index tuning wizard. Normally the wizard is doing a good job.

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]