grow a table's reserved space?

  • i want to pre-grow a table's reserved space so that an insert will be faster (the db has room already)

    anyone know of code for this?

    (I'd rather not manually add rows and delete them)


    Cheers,

    Todd

  • SQL Server tables do not have reserved space.

    SQL Server will allocate pages as needed from free space in the files that the tables is in.

  • according to sp_spaceused, there is unused space allocated for tables.

    http://msdn.microsoft.com/en-us/library/ms188776.aspx

    I can make unused space by adding rows and deleting them. just hoping there is a more elegant method.

    here are details

    i have process that inserts 400,000 rows each hour.

    if I delete the 400,000 and then insert the same rows it takes 5 mins

    If I don't delete and just insert the rows it takes 10 mins

    goal would be to reserve the space needed at 1am so that the hourly inserts are faster.


    Cheers,

    Todd

  • You're looking at the difference of pre-allocated pages being re-used, if my understanding is accurate. Less prepwork for the engine.

    SQL Server doesn't let you do pre-allocates inside the allocated physical disk space. Best you can do is make sure you've got plenty of empty space and let 'er rip... Or if you're really in a bind, pre-build the records earlier in the day with some kind of 'dummy' indicator, and then delete them/insert your real ones. I personally wouldn't recommend this because someone always builds a better idiot, but if they're pure system tables you can get away with it.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • As I said before:

    SQL Server tables do not have reserved space.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply