473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

SPEED QUESTION

In my form load()
Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader ;select
* from invoicedetail, conSea)
dim myDataSet as new dataset()
daSeaInvoice.fill(mydataset).

As I got over 50000 records in invoiceheader and over 200000 record in
invoicedetail
It seems quit slow to load the form...


Nov 20 '05 #1
11 1099
"Agnes" <ag***@dynamictech.com.hk> wrote in news:OxcbxEedEHA.3476
@tk2msftngp13.phx.gbl:
As I got over 50000 records in invoiceheader and over 200000 record in
invoicedetail
It seems quit slow to load the form...


Becuase you're loading 50,000 records into a dataset... it's sucking up all
your memory.

I wouldn't use a dataset if there are >20,000 rows.

Use a datareader instead.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #2
I'll just bet that it does seem quite slow. You're bringing over a ton of
data, little of which the user is ever actually going to be looking at.
So...how about not loading the whole works all at once? Maybe you might load
just the most recent data, perhaps enough to fill your grid or whatever
you're using, and then wait until your user wants to 'page back' or do a
filtered search on records, using some user-specified criteria. Then go back
and load the data of interest. I know it's a little more work, but nothing
comes for free.

No offense intended, but this is kind of like those people who add 100,000
items to a drop-down list box and wonder why it doesn't work too pretty
good.

Trying hard not to be irritable and not quite succeeding,
Tom Dacon
Dacon Software Consulting

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
In my form load()
Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader ;select * from invoicedetail, conSea)
dim myDataSet as new dataset()
daSeaInvoice.fill(mydataset).

As I got over 50000 records in invoiceheader and over 200000 record in
invoicedetail
It seems quit slow to load the form...

Nov 20 '05 #3
this time I understand . But I got another question. in my Invoiceheader,I
can load the current month's data
but .. in my invoicedetail, there is no field to store the"date"
How can I select from invoicedetail with the "date condition" ....

Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader from
month = currentmonth;select * from invoicedetail where ???, conSea)
thanks

"Tom Dacon" <td****@community.nospam> ¦b¶l¥ó
news:ui*************@TK2MSFTNGP11.phx.gbl ¤¤¼¶¼g...
I'll just bet that it does seem quite slow. You're bringing over a ton of
data, little of which the user is ever actually going to be looking at.
So...how about not loading the whole works all at once? Maybe you might load just the most recent data, perhaps enough to fill your grid or whatever
you're using, and then wait until your user wants to 'page back' or do a
filtered search on records, using some user-specified criteria. Then go back and load the data of interest. I know it's a little more work, but nothing
comes for free.

No offense intended, but this is kind of like those people who add 100,000
items to a drop-down list box and wonder why it doesn't work too pretty
good.

Trying hard not to be irritable and not quite succeeding,
Tom Dacon
Dacon Software Consulting

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
In my form load()
Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader

;select
* from invoicedetail, conSea)
dim myDataSet as new dataset()
daSeaInvoice.fill(mydataset).

As I got over 50000 records in invoiceheader and over 200000 record in
invoicedetail
It seems quit slow to load the form...


Nov 20 '05 #4
Making a guess here, since I don't know your schema, and no guarantees
without compiling and running it, but how about something like:

Dim daSeaInvoice As New SqlDataAdapter(
"select * from InvoiceHeader where month = currentmonth;
select * from invoicedetail where Invoicedetail.HeaderKey in (select
InvoiceHeader.PrimaryKey where month = currentmonth),
conSea)
thanks
The double select on InvoiceHeader kind of hurts if you do it as an ad hoc
query, but it might not be so bad as a stored procedure with month as the
parameter. The stored procedure could probably re-use the first result set's
primary keys instead of running another query.

Tom Dacon
Dacon Software Consulting

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... this time I understand . But I got another question. in my Invoiceheader,I
can load the current month's data
but .. in my invoicedetail, there is no field to store the"date"
How can I select from invoicedetail with the "date condition" ....

Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader from
month = currentmonth;select * from invoicedetail where ???, conSea)
thanks

"Tom Dacon" <td****@community.nospam> ¦b¶l¥ó
news:ui*************@TK2MSFTNGP11.phx.gbl ¤¤¼¶¼g...
I'll just bet that it does seem quite slow. You're bringing over a ton of data, little of which the user is ever actually going to be looking at.
So...how about not loading the whole works all at once? Maybe you might

load
just the most recent data, perhaps enough to fill your grid or whatever
you're using, and then wait until your user wants to 'page back' or do a
filtered search on records, using some user-specified criteria. Then go

back
and load the data of interest. I know it's a little more work, but nothing comes for free.

No offense intended, but this is kind of like those people who add 100,000 items to a drop-down list box and wonder why it doesn't work too pretty
good.

Trying hard not to be irritable and not quite succeeding,
Tom Dacon
Dacon Software Consulting

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
In my form load()
Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader

;select
* from invoicedetail, conSea)
dim myDataSet as new dataset()
daSeaInvoice.fill(mydataset).

As I got over 50000 records in invoiceheader and over 200000 record in
invoicedetail
It seems quit slow to load the form...



Nov 20 '05 #5
Hi Agnes,

Can you tell us what is the reason you load that bunch of data.

Keep in mind that a dataset is disconnected so when you use this as well for
updating you will get probably more and more overhead and especially
concurrency problems (when it is a multiuser environment).

Cor
Nov 20 '05 #6
I don't want to load so much data, I am starting my 3rd .net form
Every textbook teach us 'select * from myTable" and the
daInvocie.fill(dsInvoice)
It seems "load all the data first" ,so i am questioned about it.

"Cor Ligthert" <no**********@planet.nl> ¦b¶l¥ó
news:%2****************@TK2MSFTNGP10.phx.gbl ¤¤¼¶¼g...
Hi Agnes,

Can you tell us what is the reason you load that bunch of data.

Keep in mind that a dataset is disconnected so when you use this as well for updating you will get probably more and more overhead and especially
concurrency problems (when it is a multiuser environment).

Cor

Nov 20 '05 #7
Hi Agnes,

Do it than directly in the right way.

"Select myclientadres, myclientname from invoice
where myclientId = @ myclientId"

And than use the SQLparameters

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps?

Cor
Nov 20 '05 #8
Bob
Almost always when presenting data you will have to supply two essential
elements to your user interface: header search and detail presentation.
Supply criteria to the user to search through all those invoice headers,
like date, open/closed status, vendor, etc. (I typically supply a default
condition of showing only the top 300 rows if no search condition is
provided, sorting by create date descending when applicable). When the user
clicks on a row, have another section of your form load the invoice details
for that particular header.

If you still want to show invoice details based on a search (and not an
individual header), the query should look something like this:

SELECT TOP 300 d.*
FROM InvoiceHeader h
INNER JOIN InvoiceDetail d
ON d.InvoiceID = h.InvoiceID
WHERE
h.InvoiceDate = <your date variable>
AND <any other search conditions>
ORDER BY h.InvoiceID, d.InvoiceLineNumber

I put in the TOP 300 because users don't want to page through a large result
set - that's what a search feature is for. You can tell your users in a note
on the form that the result set has been truncated when necessary ("only the
top 300 search hits shown"). If a user really does want to see all 200,000
rows, this is a report, something to be printed; not a form. As such I never
user a datareader, because my queries never return large result sets.

As a side note, I don't recommend having any SQL at all in compiled code,
use stored procedures if you can; they supply a useful layer of abstraction,
boost performance, and allow you to make DB changes without having to
recompile your deployment. Also, take some time to buy a book or two on SQL
and really learn it. It will really make a big difference.

HTH,
Bob

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
this time I understand . But I got another question. in my Invoiceheader,I
can load the current month's data
but .. in my invoicedetail, there is no field to store the"date"
How can I select from invoicedetail with the "date condition" ....

Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader from
month = currentmonth;select * from invoicedetail where ???, conSea)
thanks

"Tom Dacon" <td****@community.nospam> ¦b¶l¥ó
news:ui*************@TK2MSFTNGP11.phx.gbl ¤¤¼¶¼g...
I'll just bet that it does seem quite slow. You're bringing over a ton of data, little of which the user is ever actually going to be looking at.
So...how about not loading the whole works all at once? Maybe you might

load
just the most recent data, perhaps enough to fill your grid or whatever
you're using, and then wait until your user wants to 'page back' or do a
filtered search on records, using some user-specified criteria. Then go

back
and load the data of interest. I know it's a little more work, but nothing comes for free.

No offense intended, but this is kind of like those people who add 100,000 items to a drop-down list box and wonder why it doesn't work too pretty
good.

Trying hard not to be irritable and not quite succeeding,
Tom Dacon
Dacon Software Consulting

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
In my form load()
Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader

;select
* from invoicedetail, conSea)
dim myDataSet as new dataset()
daSeaInvoice.fill(mydataset).

As I got over 50000 records in invoiceheader and over 200000 record in
invoicedetail
It seems quit slow to load the form...




Nov 20 '05 #9
I have had a similar problem before and used the overloaded dataAdapter.fill method. You can tell the fill method the starting record and how many records you would like to return.

I use this all the time to show **LOTS** of data to the user, when the user gets close to the end of the data I have loaded I go and pull more data from the DB.

OleDbDataAdapter1.Fill(DsDataSet1, intStartRec, intNumRecs, "MainDB")

Hardest part of this is figuring out where the user is and loading the appropriate records but still not that hard and it allows you to configure the number of records you are dealing with if performance becomes a problem. I.E. intNumRecs = 1000 or intNumRecs = 10

Regards,
Justin

"Agnes" wrote:
In my form load()
Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader ;select
* from invoicedetail, conSea)
dim myDataSet as new dataset()
daSeaInvoice.fill(mydataset).

As I got over 50000 records in invoiceheader and over 200000 record in
invoicedetail
It seems quit slow to load the form...


Nov 20 '05 #10
Depending on your needs you may not need a dataset and may just need a
datareader....
Disconnected datasets are nice if you need them but for small scale apps
with no potential of becoming giants, just connecting to SQL via datareader
and using SQL command objects is preferable in my opinion and even
quicker....and doesn't have those concurrency issues.

Be sure you need the features before just using what is being pushed....

It's like XML....yeah it's great for something but it really bytes for
others.... if your a big company or sending through a firewall or
comunicating cross platform it is great... but for saving files---many files
formats are a WHOLE LOT SMALLER AND EFFICIENT. So although certain
technologies are the craze they may not always be the best solution to your
particular app and espcially on smaller scale.

Even though you have 50,000 records, you may or may not want to do
datasets.... lot it over well and decide--only you can.

With datasets your connects to SQL server aren't tied up as much and you do
cut down on usage of the server by keeping local data for the user to look
at... but if you have plenty of connections and no worries there...simple
client server with data reader and SQL Command work fine for me.

My 2 cents worth,

Shane
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
In my form load()
Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader ;select * from invoicedetail, conSea)
dim myDataSet as new dataset()
daSeaInvoice.fill(mydataset).

As I got over 50000 records in invoiceheader and over 200000 record in
invoicedetail
It seems quit slow to load the form...

Nov 20 '05 #11
Depending on your needs you may not need a dataset and may just need a
datareader....
Disconnected datasets are nice if you need them but for small scale apps
with no potential of becoming giants, just connecting to SQL via datareader
and using SQL command objects is preferable in my opinion and even
quicker....and doesn't have those concurrency issues.

Be sure you need the features before just using what is being pushed....

It's like XML....yeah it's great for something but it really bytes for
others.... if your a big company or sending through a firewall or
comunicating cross platform it is great... but for saving files---many files
formats are a WHOLE LOT SMALLER AND EFFICIENT. So although certain
technologies are the craze they may not always be the best solution to your
particular app and espcially on smaller scale.

Even though you have 50,000 records, you may or may not want to do
datasets.... lot it over well and decide--only you can.

With datasets your connects to SQL server aren't tied up as much and you do
cut down on usage of the server by keeping local data for the user to look
at... but if you have plenty of connections and no worries there...simple
client server with data reader and SQL Command work fine for me.

My 2 cents worth,

Shane
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
In my form load()
Dim daSeaInvoice As New SqlDataAdapter("select * from InvoiceHeader ;select * from invoicedetail, conSea)
dim myDataSet as new dataset()
daSeaInvoice.fill(mydataset).

As I got over 50000 records in invoiceheader and over 200000 record in
invoicedetail
It seems quit slow to load the form...

Nov 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Yang Li Ke | last post by:
Hi guys, Is it possible to know the internet speed of the visitors with php? Thanx -- Yang
34
by: Jacek Generowicz | last post by:
I have a program in which I make very good use of a memoizer: def memoize(callable): cache = {} def proxy(*args): try: return cache except KeyError: return cache.setdefault(args,...
28
by: Maboroshi | last post by:
Hi I am fairly new to programming but not as such that I am a total beginner From what I understand C and C++ are faster languages than Python. Is this because of Pythons ability to operate on...
11
by: Fred Bennett | last post by:
I have a simulation project in which data can naturally be held in structures for processing. There are calls to multiple functions involved. Execution speed is an issue. Do I take a big hit for...
2
by: aaron | last post by:
Hello, I have two questions, first some background info: We are running SQL 2000 on a Windows 2003 server for out aircraft parts database software. There are 7 workstations (windows 2000...
11
by: Sezai YILMAZ | last post by:
Hello I need high throughput while inserting into PostgreSQL. Because of that I did some PostgreSQL insert performance tests. ------------------------------------------------------------ --...
45
by: charles.lobo | last post by:
Hi, I have recently begun using templates in C++ and have found it to be quite useful. However, hearing stories of code bloat and assorted problems I decided to write a couple of small programs...
1
by: =?ISO-8859-15?Q?Ma=EBl_Benjamin_Mettler?= | last post by:
Hello Python-List I hope somebody can help me with this. I spent some time googling for an answer, but due to the nature of the problem lots of unrelevant stuff shows up. Anyway, I...
4
by: halimunan | last post by:
Hello all, I have a question, how do i measure the download/upload speed... as if download rate, upload rate or kbps transfer rate. i want to do my own windows application using C# to measure the...
0
by: JuAn2226 | last post by:
hi this my code Private Sub Form_Load() car_count = 0 Cumulative_Speed = 0 End Sub Private Sub Timer1_Timer() Dim tmpNumber As Integer
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.