seek() slowness


Author
Message
Keith Chisarik
Keith Chisarik
StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)StrataFrame VIP (2.4K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
I have some code that loops through about 1/4 of a million records, it is taking a very long time (I stopped it after 15 minutes and it wasn't close to done).



I took out all the processing in the loop so that all it was doing was the loop with a single seek() and it was still slow. I replaced the seek() with "if 1 =2 then" and it went as expected (about 20 seconds).



I am seek()ing against a single integer field that I have an index on in SQL. Help????



Code:

searchstr = "rent_RPMrecnum = " & "'" & currow("record_number") & "'"

'If Me.RentitemsBO1.Seek(searchstr) Then

‘do nothing

Else

‘still do nothing for testing purposes

End if





Thanks.










Keith Chisarik
Reply
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
It doesn't matter that you have an index in SQL Server... it's irrelavent once you have the data in a data table.  What you want to do is add an index to your DataTable.  But since you cannot directly add an index, you'll have to change the column that it considers to be the "primary key".  I've never done this before, but the only index that ADO.NET keeps on a DataTable is the one on the primary key column.  That should certainly help speed things up.

table.PrimaryKey = new DataColumn[] {table.Columns["columnname"]};

I'm not entirely sure if you can do this one data is already in the table... if you can't you'll need to create a new table, set the PK, and then copy the data over. 

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Keith Chisarik - 19 Years Ago
Greg McGuffey - 19 Years Ago
Keith Chisarik - 19 Years Ago
StrataFrame Team - 19 Years Ago
Keith Chisarik - 19 Years Ago
Keith Chisarik - 19 Years Ago
StrataFrame Team - 19 Years Ago
StrataFrame Team - 19 Years Ago
Keith Chisarik - 19 Years Ago
Keith Chisarik - 19 Years Ago
Keith Chisarik - 19 Years Ago
Keith Chisarik - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Ben Hayat - 19 Years Ago
Greg McGuffey - 19 Years Ago
Greg McGuffey - 19 Years Ago
Keith Chisarik - 19 Years Ago
Ben Hayat - 19 Years Ago
Keith Chisarik - 19 Years Ago
Keith Chisarik - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Greg McGuffey - 19 Years Ago
                     I did! With FORTRAN. :crazy:
Ivan George Borges - 19 Years Ago
                         [quote]I did!

With FORTRAN. [Crazy] [/quote]

IBM...
Ben Hayat - 19 Years Ago
                             What's a punch card? :D
StrataFrame Team - 19 Years Ago
                                 1983 - Keith was 10, Trent was 7, Ben was 2 -- ok I am a little older...
Steve L. Taylor - 19 Years Ago
                                     [quote][b]Steve L. Taylor (04/03/2007)[/b][hr]1983 - Keith was 10,...
Ivan George Borges - 19 Years Ago
                                     [quote][b]Steve L. Taylor (04/03/2007)[/b][hr]1983 - Keith was 10,...
Ben Hayat - 19 Years Ago
                             [quote][b]Ben Hayat (04/03/2007)[/b][hr][quote]I did! With FORTRAN....
Ivan George Borges - 19 Years Ago
                                 [quote][b]Ivan George Borges (04/03/2007)[/b][hr][quote][b]Ben Hayat...
Ben Hayat - 19 Years Ago
                                     OK, back to business... Keith, if you change the column that is the...
StrataFrame Team - 19 Years Ago
                                         I'm going to throw out another approach. Is it possible to just...
Greg McGuffey - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search