![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a table with around 10million rows. The Primary key is (Symbol varchar(20), [date] smalldatetime). There are 50 other columns - mostly smallint, varchar(20), decimal (12,6) The Server is Win2000, 3GB RAM. When I ran: SELECT COUNT(*) FROM MYTABLE, it took 2 mins. Is it normal for it to take this long? |
|
The main query that I will be running involves ranking. INSERT INTO MYRESULTS SELECT A.Date, A.Symbol, COUNT(B.MyVal) As Rank FROM #MYTABLE A, #MYTABLE B WHERE A.Date = B.Date, A.Symbol = B.Symbol AND B.MyVal <= A.MyVal |
|
NOTE: I am first putting a Million or so records into a temp table as adding a new RANK column to the main table turned out to be very time consuming. MyVal is varchar(20) but has a numeric value) |
#3
| |||
| |||
|
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| |||
| |||
|
|
SQL Express generally performs better than SQL 2000, although there are cases where it doesn't. *It would certainly be worth a try if your data fits in the 4GB size limit. *I would use SQL Express 2008 instead of 2005 though. *You can download the advanced features pack to get Management Studio too. If your project is for your own personal use, as part of a development effort, you might also look into getting SQL Developer 2008. *It costs $45 at Amazon, and includes all of the functionality of SQL Enterprise. *That would also give you access to a recent version of Analysis Services, which is usually the fastest way to address aggregations. -- Check out my upcoming book: *ASP.NET: Building Ultra-Fast and Ultra-Scalable Websites Using ASP.NET and SQL Server |
#7
| |||
| |||
|
|
I have a table with around 10million rows. The Primary key is (Symbol varchar(20), [date] smalldatetime). There are 50 other columns - mostly smallint, varchar(20), decimal (12,6) The Server is Win2000, 3GB RAM. When I ran: SELECT COUNT(*) FROM MYTABLE, *it took 2 mins. Is it normal *for it to take this long? The main query that I will be running involves ranking. INSERT INTO MYRESULTS SELECT A.Date, A.Symbol, COUNT(B.MyVal) As Rank FROM #MYTABLE A, #MYTABLE B WHERE A.Date = B.Date, A.Symbol = B.Symbol AND B.MyVal <= A.MyVal NOTE: I am first putting a Million or so records into a temp table as adding a new RANK column to the main table turned out to be very time consuming. MyVal is varchar(20) but has a numeric value) Any suggestions on Indexing ??? and improving performance of the above query. Note that this is a research Database so adding columns, changing data types, indexes etc. can be done. I am the only user, this is the only table in the DB and I mainly need to analyze this data. Once the table is filled up it will be static. Thanks. |
#8
| |||
| |||
|
|
I have a table with around 10million rows. The Primary key is (Symbol varchar(20), [date] smalldatetime). There are 50 other columns - mostly smallint, varchar(20), decimal (12,6) The Server is Win2000, 3GB RAM. When I ran: SELECT COUNT(*) FROM MYTABLE, it took 2 mins. Is it normal for it to take this long? The main query that I will be running involves ranking. INSERT INTO MYRESULTS SELECT A.Date, A.Symbol, COUNT(B.MyVal) As Rank FROM #MYTABLE A, #MYTABLE B WHERE A.Date = B.Date, A.Symbol = B.Symbol AND B.MyVal <= A.MyVal NOTE: I am first putting a Million or so records into a temp table as adding a new RANK column to the main table turned out to be very time consuming. MyVal is varchar(20) but has a numeric value) Any suggestions on Indexing ??? and improving performance of the above query. Note that this is a research Database so adding columns, changing data types, indexes etc. can be done. I am the only user, this is the only table in the DB and I mainly need to analyze this data. Once the table is filled up it will be static. Thanks. |
#9
| |||
| |||
|
|
Should I install the FREE SQL 2005 Express and transfer this database to the 2005 installation - will this give me significant improvement in performance? |
#10
| |||
| |||
|
|
Jay (jay6447 (AT) hotmail (DOT) com) writes: Should I install the FREE SQL 2005 Express and transfer this database to the 2005 installation - will this give me significant improvement in performance? If you do a lot of this ranking, getting access to the row_number() function may be essential for good performance. I should also clarify that you should have an index on Date, Symbol, MyVal on SQL 2005/2008 as well for best performance. -- Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx |
![]() |
| Thread Tools | |
| Display Modes | |
| |