Should big tables with more cols be breaken into two tables?

  • To speed up my reports i am keeping reports specific data to reduce joins and

    calulations, they are 50000 to 200000 rows in them.

    but noticed that when i keep more number of cols my queriey gets slow

    when compaired to less no of cols.

    Q1) Is it correct ?

    Then i checked 8060 and found that data in cols are less than 8060

    Please tel me how should i see 8060, while making tables.

    should i keep less no of cols and break my table.

    so that only composite key will be repeated in two tables.

    Q2) Not only this, i also noticed that queries which are fast they become slow after clearing buffer

    , so i am trying them

    To be fast even if they are not buffered ( so please tell me is this consideration is good).

    can do some thing that every thing get buffered (because it is only reporting database)

    yours sincerely.

  • Did you look at the execution plan on the query to see if there are any bottlenecks or possible improvements?

    Do you have proper indexes on the tables based on your querying needs?

    Also, it would help if you posted the table structure, sample data and the query.

    Mark

  • Mark Eckeard (12/6/2013)


    Did you look at the execution plan on the query to see if there are any bottlenecks or possible improvements?

    Do you have proper indexes on the tables based on your querying needs?

    Also, it would help if you posted the table structure, sample data and the query.

    Mark

    I will also add that posting the actual execution plan(s), as .sqlplan file(s), would also be very useful.

  • yes i have cheked all possible things,

    and finally came to conclusion that making one flat table would be good idea.

    so all my queries are related to this flat table. and my question was related to having more cols in

    one table or to have two tables with less cols is better or not.

    selecting 50 cols out of 150 cols from a table is good or breaking the table into two and having 50 cols in one table and rest in other . and then selecting 50 cols from one table with joining.

    i just want general behaviour of sql server in above situation , so that i can decide breaking it or not

    with out making index, because i know that index will speed up and that option will be present even after breaking the

    table. so that my queries can execute in zero second in database at least.

    yours sincerly.

  • If your looking for a quick and easy way to get a fast query, sure, go with a flat table design. However, that doesn't exactly fit in to a *relational* database. For that much you could simply store your data in a text or xml file on the file system.

    Instead of asking a generic question without any info, provide some details so we can help you the correct way. Post your table structures, query and execution plan and then we can help.

    Mark

  • As a general rule you should NOT design your tables based on how you expect to query the tables. You should design your tables to support the data. Then you design your queries and indexing structure to support how you get the data out.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

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

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