473,549 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INDEX'd fields...any drawbacks?

I have a database, about 12 fields per record and roughly 100,000
records per month.

I would do the following query:

select count(*), type from TABLENAME where field0='23-23-23' group by
type;
the query would run an average of about 2secs. Not bad until I am
running the same query about 1400 times all with slightly different
field0 values.

I added an index for field0...with:
alter table TABLENAME add index (field0);

Now those same queries run about an average of 1/10th of a sec!! My
question is, is there a negative effect by indexing this field?

Obviously you woudn't index all fields...but could you?

Thanks,
--
Woody

In a world without boundaries why
do we need Gates and Windows?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1165

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

Similar topics

0
1366
by: woody at nfri dot com | last post by:
I have a database, about 12 fields per record and roughly 100,000 records per month. I would do the following query: select count(*), type from TABLENAME where field0='23-23-23' group by type; the query would run an average of about 2secs. Not bad until I am running the same query about 1400 times all with slightly different field0...
2
15569
by: deko | last post by:
The last 4 lines seem to be screwing up.... any suggestions welcome! - - - - - - - - - - - - - - Dim db As Database Dim tdf As TableDef Dim idxPk As Index Dim idxFld As Field Set tdf = db.CreateTableDef("tblAppointments") 'create new table With tdf 'add fields
1
1526
by: Matthew Wells | last post by:
I have a one to many relationship between two tables. The "one" table has a 5 field PK (total 7 fields, 1400 records) and the "many" table has a 7 field PK (total 15 fields, 1500 records). I followed the general rule of indexing each field in the PKs in both tables. I was doing a query on both tables with a "group by" to get the sum of a...
1
4160
by: Average Bear | last post by:
If anyone could help with this one, I am a bit puzzled. I understand you can create an index using two fields of a database, then use the seek method to find a record based on both fields. My code isn't working. It finds the record but the record exists under a different customer record. I want it only to find the record if both conditions...
10
8300
by: hilz | last post by:
Hi all. I have a table that i create in MsAccess, using ado connection as follows: create table PAYITEM ( PAYITEM_ID COUNTER PRIMARY KEY, PAYITEM_NAME CHAR(255) UNIQUE, PAYITEM_DESCRIPTION CHAR(255) );
3
1725
by: lauren quantrell | last post by:
In a table design, properties window there is the Indexes/Keys tab. I want to create a few indexes. Row myID is the PK. I also want indexes on rows myOne, myTwo, myThree. In the selected index window: PK_tblName I see myID. Do I put myOne, myTwo, myThree under that in the same index or do I create three new indexes for the table?
29
5427
by: shmartonak | last post by:
For maximum portability what should the type of an array index be? Can any integer type be used safely? Or should I only use an unsigned type? Or what? If I'm using pointers to access array elements as *(mptr+k) where I've declared MYTYPE *mptr; what should be the type of 'k'? Should it be ptrdiff_t?
2
5100
by: bobby_b_ | last post by:
I have a table where fields 1 and 2 make up the primary key. Because of this, I have a unique composite index on fields 1 and 2 (as required by DB2). Now my question is: Fields 1 and 2 are also separate foreign keys to two other tables. I have read that it is always a good idea to create indexes on foreign keys. Should I create single...
6
6221
by: john | last post by:
Last week I posted about making a unique index on multiple fields to prevent importing identical records twice. I still have trouble with the nulls in the index. The only way that I can make it work is to make all the index' fields required fields and set the allow nulls setting to false. But then every field in the index should always have...
0
1019
by: tedpottel | last post by:
Hi I am trying to right a script to keep a local copy of my mysql database in a local access file. I was able to do this in Access visual basic, but cannot get it to work in python. The procedure works by storing the last index value after each update. Then I do a quarry for all records with a index value bigger the the last one stored.
0
7459
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7726
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7967
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7485
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1953
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.