Indexes are your friend. Perhaps your best friend (as far as databases go)....
--------------------------- To give light on your question... you can index any field... if the entries are distinct, it's called a 'unique index' which are the best kind to use. Otherwise you have a 'non-unique index', which can also be handy.... Think of indexes, like... well... book indexes... to prevent you from looking all over the book for an answer, you can find the exact page the topic is on (unique index), or if it's covered in multiple pages, you reduce your searching to just that list of pages (non-unique index). Then there's compound indexes, which is an index on the value of two seperate fields (which can be unique, or non-unique). As a rule of thumb, you want indexes on your unique key (primary key) (call record id) Most db's make indexes automatically on keys you say are the primary key. Also on your most commonly searched fields (usually non-unique) such as foreign keys (call record id in your record notes table for example) -------------------------- If you're that new to db design, I would recommend going out and looking for some books/sites on the subject... There have been a few mentioned on this mailing list recently (Michael Kofler and Paul Dubois), http://www.databaseanswers.com/, and "Database Design for Mere Mortals" and finally Mike ([EMAIL PROTECTED]) mentioned the following online tutorials: Try one of these MySQL tutorials: http://www.mysql.com/doc/en/Tutorial.html http://www.analysisandsolutions.com/code/mybasic.htm http://www.devshed.com/Server_Side/MySQL http://www.sqlcourse.com/ http://www.w3schools.com/sql/default.asp http://www.juicystudio.com/tutorial/mysql/ http://www.justphukit.com/mysql/mysql-tutorials-1.php http://sqlzoo.net/ http://www.troobloo.com/tech/mysql.shtml http://perl.about.com/cs/mysql/index.htm http://www.anu.edu.au/web/authors/mysql/manual_Tutorial.html Reference: http://www.mysql.com/doc/en/ (the MySQL manual is quite good too) http://tiger.la.asu.edu/Quick_Ref/MySQL_QuickRef.pdf (MySQL Quick Reference Card) Related links http://dmoz.org/Computers/Software/Databases/MySQL/Tutorials/ > -----Original Message----- > From: "Héctor Villafuerte D." [mailto:[EMAIL PROTECTED] > Sent: Friday, October 24, 2003 1:40 PM > To: [EMAIL PROTECTED] > Subject: Re: Really slow query (compared with Visual FoxPro) > > > Chris Nolan wrote: > > > Hi! > > > > Given VFP's internals (I have to support FoxPro 2.6 apps, > oh the pain > > of it all!), > > MySQL should be capable of much better performance, considering the > > only thing FoxPro has in terms of a possible advantage is Rushmore. > > > > Which indexes do you have on the tables in the query? > > > > Regards, > > > > Chris > > > > Indexes? hmmm... I knew those were useful for something :) > In Visual FoxPro I don't use indexes for this table... so I didn't > considered them > necessary in MySQL (now I think I need to get to the basics of RDBMS). > This table I'm talking about is a CDR (call detail record), > so a record > represents > a call from a given telephone. I'm surely wrong but, ain't the index > suppossed to be > on a field with distinct entries? > Does VFP automagically creates indexes depending on the query? > As you can see, I would greatly appreciate any pointers to > some database > theory. > Thanks again! > Hector > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]