473,385 Members | 1,958 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,385 software developers and data experts.

Indexed file dynamics

I am relatively new with PHP and have a problem using the SELECT function. While accessing a 66,000 record database, I am attempting to read CITY, STATE, AND ZIP. The file has as one of its indexes CITY STATE ZIP. However, I have noticed that the read is very slow when there are many identical CITY STATE with various zipcodes, and rapid when only a few. How could this be? An indexed search should immediately retrieve the correct CITY STATE and ZIP as requested in the search. Does one have to use special code to force an indexed search or does <PHP> SELECT * from FILENAME where CITY ='$City' and STATE = '$State and ZIP = '$Zip'"; </PHP> default to a sequential search. Please explain what is happening here. I would greatly appreciate a solution to this problem. Thank you.
Nov 23 '06 #1
1 1172
your tables structures is not normal, but i'm not judge you that you are wrong, but actually this give you a problem don't you.

you need to "normalize" your table structure (i'm not good enough, but i suggest you to learn this from books, net or friends maybe).
---------
table state : state_id, state_name (primary key state_id)
table city : city_id, state_id, city_name (primary key city_id, state_id)
table zip : zip_number, city_id (primaty key zip_number)

select state.state_id, state_name, city.city_id, city_name, zip_number from state, city, zip where state.state_id = city.state_id and city.city_id = zip.city_id and state.state_id = $sid and city.city_id = $cid and zip_number = $zn;

with this shema so you can get how much city on a state, and etc,
select state_name, count(city_id) from state,city where state.state_id = city.state_id group by state.state_id;
Nov 24 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Alberto Santini | last post by:
I ported a Jos Stam's demo about Fluid mech to check the difference of speed between C implementation and Python. I think I achieved good results with Python and there is space to improve, without...
4
by: Fredrik Henricsson | last post by:
Hey, I'm building an ontology in Protégé and I want to transform parts of it (e.g. the instances) to HTML with XSL. When I was transforming another file with 'simple' XML-tags like <author> before,...
5
by: google | last post by:
first, a little background... i have a C program which preprocesses some data, and then outputs the results into a text file. that text file, in turn, is used as input to a FORTRAN...
8
by: **Developer** | last post by:
Seems that Dot.net can not handle files of Indexed Pixel Format as well as other types of formats. Given a file or and Image of type Indexed Pixel Format is there a method to convert it to some...
3
by: aldonnelley | last post by:
Hi there. I'm just learning c++, and this is driving me nuts. I'm trying to save image files generated in a for loop with a filename built using strcat with: - a char base file name + a...
0
by: soatutorial | last post by:
Microsoft Dynamics CRM 3.0 Implementation For Large Corporation (August 2006) How Microsoft CRM 3.0 could contribute and be a part of its computer environment. (Sales Module, MS CRM Security,...
0
by: xhy_China | last post by:
Hi,I want to ask three questions(in vs.net and C#): 1. how can I know whether a bitmap is an indexed or non-indexed? 2. how can I convert a indexed bitmap to non-indexed bitmap? 3. how can I...
8
by: Joergen Bech | last post by:
Suppose I have Dim bm As New Bitmap(16, 16,Imaging.PixelFormat.Format8bppIndexed) I cannot use Dim g As Graphics = Graphics.FromImage(bmdest) Dim hdc As IntPtr = g.GetHdc() as the...
25
by: Rick Collard | last post by:
Using DAO 3.6 on an Access 2002 database, I'm getting unexpected results with the FindFirst method. Here's the simple code to test: Public Sub FindIt() Dim db As Database, rs As Recordset...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.