Well, let's start with the simply, yet possibly overlooked solution: have
you indexed the table appropriately?

Mike Hillyer

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:m.colurcio@;softhor.com]
Sent: Saturday, October 19, 2002 9:12 AM
To: [EMAIL PROTECTED]
Subject: Slow opening a recordset


Hi all

I'm having a performance problem opening a recordset using a CRecordset
class
(Visual C++).
If the table is empty (or contains few records) it takes a very little time
to
open, but if the table contains many records (about 48000 in my tests) it
takes
too much time (about 20 seconds) to open.

The table is very simple:

CREATE TABLE accounts (
        IDAccount int(11) NOT NULL  auto_increment,
        IDUser int(11)   ,
        Date timestamp(14)   ,
        Status varchar(50)   ,
        IDItem int(11)   ,
        Qty double   ,
        Price double   ,
        Visible int(11)    ,
        PRIMARY KEY (IDAccount)
) TYPE=MyISAM;

Of course I tried to 'play' with DSN options and, as suggested in MYODBC
faq, I
cheched off the options " Return Matching Rows ", " Allow BIG Results " and
"
Enable Dynamic Cursor " without results.
I tried to set the check " Don't Cache Results... " & " Force use of
Forward-only Cursors " and it seemed to work but in that case I had 2
problems:
1. I cannot update/modify records
2. it takes the same long time (about 20 seconds) to CLOSE the recordset

This is the environment:
MySQL 3.23.51
MyODBC 3.51.04 (I tried with 3.51.03 & 2.50)
VisualC++ 5.0 (MFC4.2)
Windows 98se
PII 350

and this is a piece of code I use:

        CAccountsSet ASet;
        COleDateTime dtStart, dtStop;
        COleDateTimeSpan dts;
        CString sBuffer;

        dtStart = COleDateTime::GetCurrentTime();
        ASet.Open();
        ASet.Close();
        dtStop = COleDateTime::GetCurrentTime();
        dts = dtStop - dtStart;
        sBuffer.Format( _T("Accounts has been opened in %.0f sec"),
dts.GetTotalSeconds());
        MessageBox( sBuffer );

where CAccountsSet is derived from CRecordset (using ClassWizard)

Does anybody know how I can solve this problem?
How can I improve the " opening " performance?
Does MySQL cache something for each records?

TIA,
Massimo

-----------------------------------------------------
This mail sent through IMP: http://web.horde.org/imp/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to