Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vishesh_marwah
Starting Member
5 Posts |
Posted - 2006-03-27 : 11:47:13
|
Please help. could somebody tell me what is the cost of select max(column) from table if the table has say 1000 rows.Thanks for your time !Have a good day ! is for all who opened this. |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-03-27 : 11:50:45
|
| What do u mean by Cost ? How do u want to compare it (with what)? |
 |
|
|
vishesh_marwah
Starting Member
5 Posts |
Posted - 2006-03-27 : 12:01:28
|
| I mean I want to get max(column1) which is numeric from table1 which has many many rows say 100000 rows. what is the best way to do it in terms of efficiency, less time, less reads and so that as it is multi-user system other users are not bothered.:)Thanks. |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-03-27 : 12:05:46
|
| Your table is growing quickly - it's gone from 1000 rows to 100000 rows in a few minutes.Simplest is to put a non clustered index on the column.Another option is to have a trigger which updates the value in another table - only updating if the new value is higher. Then just read that value.Is this a max of all the values in the column or is there a where clause to go with it?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
vishesh_marwah
Starting Member
5 Posts |
Posted - 2006-03-27 : 12:10:49
|
quote: Originally posted by nr Your table is growing quickly - it's gone from 1000 rows to 100000 rows in a few minutes.Simplest is to put a non clustered index on the column.Another option is to have a trigger which updates the value in another table - only updating if the new value is higher. Then just read that value.Is this a max of all the values in the column or is there a where clause to go with it?--------------------------------------------------------------------Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy.
Thanks, I got most of the solution, just some clarifications needed. First, to your question: the max of all values is with 1 condition/clause. I am developing a multi-user VB.NET solution with SQL Server backend. Which option is the best in terms so that deadlocks are not there.  |
 |
|
|
vishesh_marwah
Starting Member
5 Posts |
Posted - 2006-03-27 : 12:11:45
|
| I forgot to mention your name,nr, :) is for u |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-03-27 : 15:42:55
|
| Why do you want to do this and how are you coding it?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
vishesh_marwah
Starting Member
5 Posts |
Posted - 2006-03-30 : 04:54:31
|
quote: Originally posted by nr Why do you want to do this and how are you coding it?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy.
Thanks a lot ! I got the solution. |
 |
|
|
|
|
|