Tips & Hints regarding DB/App design

2003-06-10 Thread Thomas Kvamme
Hi All,

Needs some tips & hints on how to "BEST" design a spesific database.

I have a customer table containing the following fields (just an example):

CustomerID-  The customers ID Number
AccountBalance - The customers Account Blanace / or available funds if you like
StockVolume- The number of Stocks hold by the customer

Now I want to make an application where all the customer can trade stocks with each 
other.

My first idea was to use 2 tables 1 table holding all the stocks on sales and another 
table
holding the stocks for bying.

example:

Table: stocksales

CustomerID
StockVolume
SalesPrice


Table: stockpurchase

CustomerID
StockVolume
PurchasePrice


This application will of course be used by many customers at the same time...  

How to best handle this in MySQL ?  What if several customers tries to buy the
same stocks at the same time ?? Any locking methods?

Any hints & tips to best design such an database and/or application I'll appreciate it.

I'm open for any suggestions.

If it does matter:  I'm going to use MySQL & Delphi Enterprise 6

Kind Regards
Thomas Kvamme

Re: Adding a user problem

2003-01-27 Thread Thomas Kvamme
Devin Miller wrote:
>
> I am pretty new to mysql and have been teaching myself slowly how to use
it.
> I am however stuck on a problem. I login to mysql as user root and created
a
> database named devin. I then issue the following commands:
>
> GRANT ALL PRIVILEGES
> ON devin.*
> TO dmiller@"%"
> IDENTIFIED BY "password";
>

Try this

GRANT ALL PRIVILEGES
ON devin.*
TO 'dmiller'@'%'
IDENTIFIED BY 'password';

This worked for me... notice the quote around the username.

--
Thomas


-
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




Re: How to speed things up in MySQL ?

2003-01-26 Thread Thomas Kvamme
Steven Roussey wrote:

> > I guess the reason for this is that the I have a some blob fields
> whitch are
> > all used.. (each record consist of approx 600 KB...)
>
> There it is. MySQL's MyISAM will get the whole record even if it only
> needs a part. You can try InnoDB as it does it differently.

Hi Steve,

Yes I tried changing the table to InnoDB and I got a great speed at once...
if the ProductionYear field was indexed.

But on Non-indexed field it actually seemed to be a bit slover than the
MyISAM.

> [At some point I may try and add that capability to MyISAM. I've been
> researching good ways to compress text and still search it in its
> compressed state. Then I hope to add the ability of MyISAM tables to
> automatically compress TEXT/VARCHAR/CHAR (non binary) fields without
> worrying about uncompressing everything if someone does a LIKE on that
> field. BLOBs can use gzip type compression. And neither the data nor
> decompression should occur if the field is not used. When I get more
> time...]

Yes.. This sound like a nice feature. :-)

> However, back to your issue. Have you tried adding
> INDEX(ProductionYear,ID)? That would prevent MySQL from having to read
> the datafile at all, since it could find everything it needs in the
> index file.

My ID field has always been the Primary Key and I added ProductionYear as a
INDEX.

Like this INDEX(ProductionYear).

I just tried adding the ID to that index as you suggest above and I got the
desired speed right away :-)))

And when I did an Explain select... the Type changed from "ALL" to "Index"
:-)


> My speed guesses:
>
> o If you didn't change the structure of the table or add an index, then
> switching to InnoDB would improve performance quite a bit.
>

Tested & Verified :-)

>
> o Adding an index(ProductionYear) to the above InnoDB table would speed
> things even more.
>

Tested & Verified :-)

> o Adding INDEX(ProductionYear,ID) to the MyISAM table would be even
> faster still.
>

Tested & Verified :-)

> -steve-
>
> http://Network54.com
>

Thanks to all of you who have spent time in my problem... I now consider the
problem as solved :-)

If I want to have all my data in one table as inteded I have now received 3
possible solution to gain maximum speed.

1.Modify Index to INDEX(ProductionYear, ID)  - and conintue to use
MyISAM
2.Convert Table to InnoDB and Add INDEX(ProductionYear).
3.Split up the table and e.g. keep blob fields etc. in a separate
table.

I very mutch like the file structure used by MyISAM table compared to InnoDB
and will therefore stay with the MyISAM Table Type :-)

And I will Add the ID field to my ProductionYear Index.   I will also as
people have suggested split up my table moving my biggest field (Cover blob)
to a separate table.

I actially tested this:  Before I added ID to the Index which required the
select command to do a full scan I got a greate speed by just moving the
Cover field to a separate table... and by adding the ID to the Index I
gained another fraction of second :-)

Again.. Thanks to you all for the support

Kind Regards
Thomas Kvamme
[EMAIL PROTECTED]



-
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




Re: How to speed things up in MySQL ?

2003-01-26 Thread Thomas Kvamme
Sergei Golubchik <[EMAIL PROTECTED]> wrote:
>
> Because MyISAM always reads the record as a whole, it cannot read only
> selected fields.
>
> You can convert your table to InnoDB table type - as InnoDB *can* read
> only selected fields.
>
> Actually, it's useful optimization to store big, rarely selected fields
> in the separate table. This will also help to speed things up.
>
> Regards,
> Sergei
>
> --
> MySQL Development Team
>__  ___ ___   __
>   /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <[EMAIL PROTECTED]>
>  / /|_/ / // /\ \/ /_/ / /__  MySQL AB, http://www.mysql.com/
> /_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
><___/
>

AAAhhh   This is orgasmic :-))

Using the MySQL CC I just changed the table type from MyISAM to InnoDB
re-issued the SQL Query

Here is the result:

[TDD - DVD] 39 rows in set (0.02) sec

But the field had to be indexed... I tried the same command using Group by
Director and it was about 15 seconds again.. then I added a Index for
Director... and walla 0.02 seconds.  I can index the entire table if
necessary :-))

So the question is then... why is MyISAM the default table type ??

I guess it's the preferred table since it is the default talbe but Why ?

Using MyISAM it seems that all the tables are stored under a directory
reflecting the Database Name. which was nice..

Using InnoDB I now have 4 new files in the \MySql\Data\ directory... and of
course unable to tell which table it belong to reading the name of it.

Another question:  When I use "SELECT COUNT(ID) FROM DVD" I always get 320
records as the result.

But in MySQL CC when I Right-Click on the Table and Select "Refresh" the
field "Records" always changes and its incorrect..

--
Thomas Kvamme
[EMAIL PROTECTED]


-
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




Re: How to speed things up in MySQL ?

2003-01-26 Thread Thomas Kvamme
Benjamin Pflugmann" <[EMAIL PROTECTED]> wrote:
> Hi.
>

Hi Benjamin :-)

> On Sun 2003-01-26 at 00:26:32 +0100, [EMAIL PROTECTED] wrote:
> > Here is the table definition as requested.
> >
> > I'm sorry I could take a full dump... Each record consist of approx 600
KB
> > (just as in the Paradox table) so the file would be very big. (200 MB).
>
> Well, you should have told us that to begin with. ;)
>

Sorry about that.. but since the Paradox table have the same size and
aprarently not the problem so I didn't think it was necessary.

>
> 600KB/record is not that usual. You are querying for ProductionYear
> but have no usuable index for it. That results in a full table scan,
> which has to read 200MB from disk, which is not unreasonble to take 13
> secs, depending on your hardware. Btw, this also means that you can
> disregard my comment from the other mail about disk usage. I really
> did not expect your rows being so large without you mentioning it.
>

Why does MySQL needs to scan the Entire Table (all 200 MB) when I only have
selected ID & ProductionYear in the SELECT statement ??

Paradox & BDE only scans/read the selected fields. (otherwise Paradox would
use the same amount of time of course).

>
> Don't know why Paradox is faster. Maybe it can make partial use of one
> of the combined indexes which contain ProductionYear.
>

I added another Index

KEY (ProductionYear).

Well... It gave me 3 seconds... so still the commands takes more than 10
seconds to complete.

I tested this on Paradox as well... I removed ALL index and tried again...
still the same greate speed even without indexes. and  I think - this
becasue it doesn't need to read/scan all the fields not specified in the
SELECT statement.


I guess it would be too much to ask the MySQL development team to
re-organize MySQL on a file-level *lol*  But I think the problem here is
that the table consist of 1 big file  that way MySQL must to read the
entire record so the file pointer is at the beginning of the next record and
ready to read it.

In Paradox all Non-Fixed-Length fields  such as Blob fields etc. are stored
in a separate file...  while the primary file only contains pointers to the
Dynamic file if you like

So taking a full scan doesn't require it to read/scan through Blob fields
unless they are specified within the SELECT statement.

Kind  Regards
Thomas Kvamme
[EMAIL PROTECTED]

>
> Anyhow, creating an index on ProductionYear will do the job, so that
> the query runs fast. I am not sure if referring to ID in count(ID) is
> a problem. If so, replace it by count(*) additionally.
>

Tested this... didn't make any difference (even on MySQL nor Paradox).

>
> If you often have to query on non-indexed fields, the usual solution
> is to split up the table into two: one containing the fields on which
> you want to query, the other the fields which you only query by
> primary key (probably most blob fields). And use a join if you want
> some blob depending on one of the "query" fields.
>

>
> This way the table size to read for full table scans will be much
> smaller. Btw, this is not MySQL-specific, but true for any
> database. It would also get the times with Paradox in the sub-second
> range.
>
> HTH,
>
> Benjamin.
>
>
> PS: Why don't you use a (small)int for ProductionYear?
>
>
> > CREATE TABLE dvd (
> >   ID int(11) NOT NULL auto_increment,
> >   Title varchar(100) default NULL,
> >   ProductionYear varchar(4) default NULL,
> [...]
> >   Starring blob,
> >   SoundTracks blob,
> >   Subtitles blob,
> >   SpecialFeatures blob,
> >   Comments blob,
> >   PlotOutline blob,
> >   FullCredits longblob,
> >   Cover longblob,
> [...]
> >   PRIMARY KEY  (ID),
> >   KEY Added (Added),
> >   KEY Title (Title,ProductionYear),
> >   KEY NorwegianTitle (NorwegianTitle,ProductionYear)
> > ) TYPE=MyISAM;
> > * END 
> [...]
> > > > mysql> select count(id) as Films, ProductionYear from DVD
> > > > -> group by ProductionYear
> > > > -> order by ProductionYear desc;
> [...]
>
> --
> [EMAIL PROTECTED]
>
> -
> 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




Re: How to speed things up in MySQL ?

2003-01-26 Thread Thomas Kvamme
Zak Greant wrote:

> I am coming in a bit late on this - however, did you send in a copy of
> the table structure?
>
> It sounds like you don't have indexes on the tables.
>
> --zak
>
> On Sun, Jan 26, 2003 at 12:59:31AM +0100, Thomas Kvamme wrote:
> > Hi again,
> >
> > Just did another test which I find very interesting
> >
> > Using the Paradox table instead of the MySQL table I managed to load
each
> > and every record & search through every field (including all the text in
all
> > the blob field) in just 6 seconds.  and still doing a simple group
SELECT
> > GROUP BY on the same table in MySQL takes 13 seconds... still can't
belive
> > it.
>
> --
>  Zak Greant <[EMAIL PROTECTED]> | MySQL Advocate |
http://zak.fooassociates.com
>
> MySQL Tip: Impress your friends with nifty MySQL one-liners
>   % mysql --execute "\u mysql; SELECT DISTINCT user FROM user ORDER BY
user;"
>
> Support Global Human Rights - Amnesty International (http://amnesty.org)
>
>

Hi,

I do have indexes...

ID - PRIMARY KEY

Secondary Indexes:
Title (Title, ProductionYear)
NorwegianTitle (NorwegianTitle, ProductionYear)

I even added anotherr Index:

ProductionYear (ProductionYear)

The GROUP BY still takes more than 10 seconds.

I guess the reason for this is that the I have a some blob fields whitch are
all used.. (each record consist of approx 600 KB...)

But since I donesn't include any of the blob fields in the SELECT statement
I can't see no reason why MySQL should scan all the fields.

** Table Dump *
 BEGIN ***
-- MySQL dump 9.07
--
-- Host: localhostDatabase: tdd
-
-- Server version 4.0.9-gamma-nt

--
-- Table structure for table 'dvd'
--

CREATE TABLE dvd (
  ID int(11) NOT NULL auto_increment,
  Title varchar(100) default NULL,
  ProductionYear varchar(4) default NULL,
  TagLine varchar(200) default NULL,
  NorwegianTitle varchar(100) default NULL,
  NorwegianTagLine varchar(200) default '',
  Director varchar(100) default '',
  Story varchar(100) default '',
  Producer varchar(100) default '',
  Genre varchar(100) default '',
  Production varchar(200) default '',
  Distribution varchar(200) default '',
  NorwegianDistribution varchar(200) default '',
  ScreenFormat varchar(50) default '16:9 Anamorphic Widescreen',
  AspectRatio varchar(10) default '2:35:1',
  DVDDiscType char(2) default '9',
  DVDRegion char(1) default '2',
  RunningTime time default '00:00:00',
  IMDB varchar(20) default '',
  Starring blob,
  SoundTracks blob,
  Subtitles blob,
  SpecialFeatures blob,
  Comments blob,
  PlotOutline blob,
  FullCredits longblob,
  Cover longblob,
  THXCertified enum('False','True') default 'False',
  DDEX enum('False','True') default 'False',
  DTS enum('False','True') default 'False',
  MPEG enum('False','True') default 'False',
  Recommended enum('False','True') default 'False',
  Added datetime default '-00-00 00:00:00',
  Updated datetime default '-00-00 00:00:00',
  PRIMARY KEY  (ID),
  KEY Added (Added),
  KEY Title (Title,ProductionYear),
  KEY NorwegianTitle (NorwegianTitle,ProductionYear)
) TYPE=MyISAM;
* END 



-
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




Re: How to speed things up in MySQL ?

2003-01-25 Thread Thomas Kvamme
Hi again,

Just did another test which I find very interesting

Using the Paradox table instead of the MySQL table I managed to load each
and every record & search through every field (including all the text in all
the blob field) in just 6 seconds.  and still doing a simple group SELECT
GROUP BY on the same table in MySQL takes 13 seconds... still can't belive
it.

--
Thomas

- Original Message -
From: "Bhavin Vyas" <[EMAIL PROTECTED]>
To: "Thomas Kvamme" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, January 25, 2003 5:15 PM
Subject: Re: How to speed things up in MySQL ?


> Sounds weird. Can you e-mail us a 'mysqldump' of the table defination with
> the data?
>
> Thanks,
> Bhavin.
> - Original Message -
> From: "Thomas Kvamme" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, January 25, 2003 7:36 AM
> Subject: How to speed things up in MySQL ?
>
>
> > Hello,
> >
> > While reading this you may think this is off-topic... but please read
on..
> > I'll get on-topic in the end :-))
> >
> > First of all I have Web Server on which I have a Paradox table with 320
> > records.
> >
> > I also have a CGI Script (or program if you like) I made in Borland
Delphi
> > which I use to access the Table...
> >
> > When I enter the address of my CGI-script in my Internet Browser the
> > following happens:
> >
> >The CGI script on the Web Server is starting.
> >The CGI script reads the SQL command to execute passed on to the
script
> > through the HTTP protocol.
> >The CGI script establish connection with the Borland Database Engine
> > (Loading BDE dll's etc..)
> >The CGI script opens/initialize the Paradox Table.
> >The CGI script execute the SQL command sent to it.
> >The CGI script sends back the result of the SQL command to the
Browser
> > (HTTP protocol).
> >The CGI script closes down (shutting down db connection etc..).
> >
> > My PC and my Web Server is connected on the same LAN (switched 100
MBit/s)
> >
> > All of the above is completed in 1.5 seconds.
> >
> > ** here the fun begins **
> >
> > I have now successfully installed MySQL (on the same WebServer) and
> > converted the Paradox Table to MySQL Table type: MyISAM.
> >
> > Database Name: TDD
> > Table Name: DVD
> >
> > This new Table contains the same 320 records using the same field
> definition
> > as in the Paradox Table.
> >
> > On my Web Server I go into \MySQL\bin\ and start "mysql -uroot -p" and
> > execute the same SQL command as sent to the Paradox table through the
CGI
> > script.  see screen dump below for result.
> >
> >  SCREEN DUMP **
> > F:\MySQL\bin>mysql -uroot -p
> > Enter password: **
> > Welcome to the MySQL monitor.  Commands end with ; or \g.
> > Your MySQL connection id is 3726 to server version: 4.0.9-gamma-nt
> >
> > Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
> >
> > mysql> use tdd
> > Database changed
> > mysql> select count(id) as Films, ProductionYear from DVD
> > -> group by ProductionYear
> > -> order by ProductionYear desc;
> > +---++
> > | Films | ProductionYear |
> > +---++
> > |19 | 2002   |
> > |44 | 2001   |
> > |58 | 2000   |
> > |41 | 1999   |
> > |27 | 1998   |
> > |16 | 1997   |
> > |11 | 1996   |
> > | 9 | 1995   |
> > |12 | 1994   |
> > | 8 | 1993   |
> > | 7 | 1992   |
> > | 3 | 1991   |
> > | 7 | 1990   |
> > | 6 | 1989   |
> > | 2 | 1988   |
> > | 6 | 1987   |
> > | 2 | 1986   |
> > | 2 | 1985   |
> > | 6 | 1984   |
> > | 4 | 1983   |
> > | 3 | 1982   |
> > | 3 | 1981   |
> > | 2 | 1980   |
> > | 3 | 1979   |
> > | 2 | 1978   |
> > | 1 | 1976   |
> > | 1 | 1975   |
> > | 2 | 1974   |
> > | 2 | 1973   |
> > | 1 | 1972   |
> > | 1 | 1971   |
> > | 1 | 1970   |
> > | 1 | 1969   |
> > | 1 | 1968   |
> > | 2 | 1965  

Re: How to speed things up in MySQL ?

2003-01-25 Thread Thomas Kvamme
Hi Bhavin.

Thanks for taking interest in my problem...

Here is the table definition as requested.

I'm sorry I could take a full dump... Each record consist of approx 600 KB
(just as in the Paradox table) so the file would be very big. (200 MB).

Kind Regards
Thomas Kvamme
[EMAIL PROTECTED]

 BEGIN ***
-- MySQL dump 9.07
--
-- Host: localhostDatabase: tdd
-
-- Server version 4.0.9-gamma-nt

--
-- Table structure for table 'dvd'
--

CREATE TABLE dvd (
  ID int(11) NOT NULL auto_increment,
  Title varchar(100) default NULL,
  ProductionYear varchar(4) default NULL,
  TagLine varchar(200) default NULL,
  NorwegianTitle varchar(100) default NULL,
  NorwegianTagLine varchar(200) default '',
  Director varchar(100) default '',
  Story varchar(100) default '',
  Producer varchar(100) default '',
  Genre varchar(100) default '',
  Production varchar(200) default '',
  Distribution varchar(200) default '',
  NorwegianDistribution varchar(200) default '',
  ScreenFormat varchar(50) default '16:9 Anamorphic Widescreen',
  AspectRatio varchar(10) default '2:35:1',
  DVDDiscType char(2) default '9',
  DVDRegion char(1) default '2',
  RunningTime time default '00:00:00',
  IMDB varchar(20) default '',
  Starring blob,
  SoundTracks blob,
  Subtitles blob,
  SpecialFeatures blob,
  Comments blob,
  PlotOutline blob,
  FullCredits longblob,
  Cover longblob,
  THXCertified enum('False','True') default 'False',
  DDEX enum('False','True') default 'False',
  DTS enum('False','True') default 'False',
  MPEG enum('False','True') default 'False',
  Recommended enum('False','True') default 'False',
  Added datetime default '-00-00 00:00:00',
  Updated datetime default '-00-00 00:00:00',
  PRIMARY KEY  (ID),
  KEY Added (Added),
  KEY Title (Title,ProductionYear),
  KEY NorwegianTitle (NorwegianTitle,ProductionYear)
) TYPE=MyISAM;
* END 


- Original Message -
From: "Bhavin Vyas" <[EMAIL PROTECTED]>
To: "Thomas Kvamme" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, January 25, 2003 5:15 PM
Subject: Re: How to speed things up in MySQL ?


> Sounds weird. Can you e-mail us a 'mysqldump' of the table defination with
> the data?
>
> Thanks,
> Bhavin.
> - Original Message -
> From: "Thomas Kvamme" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, January 25, 2003 7:36 AM
> Subject: How to speed things up in MySQL ?
>
>
> > Hello,
> >
> > While reading this you may think this is off-topic... but please read
on..
> > I'll get on-topic in the end :-))
> >
> > First of all I have Web Server on which I have a Paradox table with 320
> > records.
> >
> > I also have a CGI Script (or program if you like) I made in Borland
Delphi
> > which I use to access the Table...
> >
> > When I enter the address of my CGI-script in my Internet Browser the
> > following happens:
> >
> >The CGI script on the Web Server is starting.
> >The CGI script reads the SQL command to execute passed on to the
script
> > through the HTTP protocol.
> >The CGI script establish connection with the Borland Database Engine
> > (Loading BDE dll's etc..)
> >The CGI script opens/initialize the Paradox Table.
> >The CGI script execute the SQL command sent to it.
> >The CGI script sends back the result of the SQL command to the
Browser
> > (HTTP protocol).
> >The CGI script closes down (shutting down db connection etc..).
> >
> > My PC and my Web Server is connected on the same LAN (switched 100
MBit/s)
> >
> > All of the above is completed in 1.5 seconds.
> >
> > ** here the fun begins **
> >
> > I have now successfully installed MySQL (on the same WebServer) and
> > converted the Paradox Table to MySQL Table type: MyISAM.
> >
> > Database Name: TDD
> > Table Name: DVD
> >
> > This new Table contains the same 320 records using the same field
> definition
> > as in the Paradox Table.
> >
> > On my Web Server I go into \MySQL\bin\ and start "mysql -uroot -p" and
> > execute the same SQL command as sent to the Paradox table through the
CGI
> > script.  see screen dump below for result.
> >
> >  SCREEN DUMP **
> > F:\MySQL\bin>mysql -uroot -p
> > Enter password: **
> 

How to speed things up in MySQL ?

2003-01-25 Thread Thomas Kvamme
Hello,

While reading this you may think this is off-topic... but please read on..
I'll get on-topic in the end :-))

First of all I have Web Server on which I have a Paradox table with 320
records.

I also have a CGI Script (or program if you like) I made in Borland Delphi
which I use to access the Table...

When I enter the address of my CGI-script in my Internet Browser the
following happens:

   The CGI script on the Web Server is starting.
   The CGI script reads the SQL command to execute passed on to the script
through the HTTP protocol.
   The CGI script establish connection with the Borland Database Engine
(Loading BDE dll's etc..)
   The CGI script opens/initialize the Paradox Table.
   The CGI script execute the SQL command sent to it.
   The CGI script sends back the result of the SQL command to the Browser
(HTTP protocol).
   The CGI script closes down (shutting down db connection etc..).

My PC and my Web Server is connected on the same LAN (switched 100 MBit/s)

All of the above is completed in 1.5 seconds.

** here the fun begins **

I have now successfully installed MySQL (on the same WebServer) and
converted the Paradox Table to MySQL Table type: MyISAM.

Database Name: TDD
Table Name: DVD

This new Table contains the same 320 records using the same field definition
as in the Paradox Table.

On my Web Server I go into \MySQL\bin\ and start "mysql -uroot -p" and
execute the same SQL command as sent to the Paradox table through the CGI
script.  see screen dump below for result.

 SCREEN DUMP **
F:\MySQL\bin>mysql -uroot -p
Enter password: **
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3726 to server version: 4.0.9-gamma-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use tdd
Database changed
mysql> select count(id) as Films, ProductionYear from DVD
-> group by ProductionYear
-> order by ProductionYear desc;
+---++
| Films | ProductionYear |
+---++
|19 | 2002   |
|44 | 2001   |
|58 | 2000   |
|41 | 1999   |
|27 | 1998   |
|16 | 1997   |
|11 | 1996   |
| 9 | 1995   |
|12 | 1994   |
| 8 | 1993   |
| 7 | 1992   |
| 3 | 1991   |
| 7 | 1990   |
| 6 | 1989   |
| 2 | 1988   |
| 6 | 1987   |
| 2 | 1986   |
| 2 | 1985   |
| 6 | 1984   |
| 4 | 1983   |
| 3 | 1982   |
| 3 | 1981   |
| 2 | 1980   |
| 3 | 1979   |
| 2 | 1978   |
| 1 | 1976   |
| 1 | 1975   |
| 2 | 1974   |
| 2 | 1973   |
| 1 | 1972   |
| 1 | 1971   |
| 1 | 1970   |
| 1 | 1969   |
| 1 | 1968   |
| 2 | 1965   |
| 1 | 1964   |
| 1 | 1959   |
| 1 | 1940   |
| 1 | 1937   |
+---++
39 rows in set (13.32 sec)

mysql>
***

How is this possible ??  13.32 seconds ???

And this was when I was directly logged on to the Database (via Localhost)!

When Using my Paradox table this took 1.5 second through my CGI script over
the Intranet.

I have another function in my CGI script sending 2 different SQL commands to
the Paradox table.. this entire job completes in less than 3 seconds.

In MySQL these 2 job takes more than 30 seconds to complete.

What can I do to speed this up ?

PS: The DVD table containing the 320 records is the only table on the
server. (except from the MySQL database and the empy Test Database).  Both
the Paradox Table and the MySQL server is installed on the same Harddrive so
harddisk speed shouldn't be a factor.

Appreciate any help to solve the above :-)))

Kind Regards
Thomas Kvamme
[EMAIL PROTECTED]


-
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