Speeding up a query (1 Viewer)

Henley12

Troy University Fan
Local time
Today, 10:10
Joined
Oct 10, 2007
Messages
222
I have a huge table that I am trying to query for a date range. Is it faster to do a select on just the fields I need as opposed to a SELECT * FROM (tblname)?
 

namliam

The Mailman - AWF VIP
Local time
Today, 17:10
Joined
Aug 11, 2003
Messages
11,695
Nope dont matter... * or specific fields (if your in an access database)

make sure your using real dates and/or that the date fields are indexed
 

Henley12

Troy University Fan
Local time
Today, 10:10
Joined
Oct 10, 2007
Messages
222
The date fields are indexed, however they are down on the list of indexed fields. Somewhere in the 5 or 6 range. That would make quite a difference, wouldn't it?
 

boblarson

Smeghead
Local time
Today, 08:10
Joined
Jan 12, 2001
Messages
32,059
Actually, it CAN make a difference in pulling ONLY the fields you want instead of *.
 

namliam

The Mailman - AWF VIP
Local time
Today, 17:10
Joined
Aug 11, 2003
Messages
11,695
Bob, if you are INSIDE an access database?

Doing * can offcourse make a difference in particular if the data is beeing draged over a (slow?) intranet/network, more data> More time

Also any optimizer will have to look at what columns there actually are, but that should <on average> take about 0.0001 seconds
 

Henley12

Troy University Fan
Local time
Today, 10:10
Joined
Oct 10, 2007
Messages
222
This is not an Access database. I believe it is an Oracle database.
 

boblarson

Smeghead
Local time
Today, 08:10
Joined
Jan 12, 2001
Messages
32,059
Bob, if you are INSIDE an access database?

Doing * can offcourse make a difference in particular if the data is beeing draged over a (slow?) intranet/network, more data> More time

Also any optimizer will have to look at what columns there actually are, but that should <on average> take about 0.0001 seconds
Never ask SQL Server (or Oracle) to send you more data than you need. Take advantage of it's abilities and do not rely on Access to narrow things down especially if you were to say have 100 people working with this Access database and all were hitting the SQL Server (or Oracle) for * on the tables. It makes no sense and your network admins are going to get pissed.
 

Users who are viewing this thread

Top Bottom