473,473 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to index the flat file like mysql

151 New Member
In mysql values can be retrieved like less than a given value.
select * from table where number > 12. But using mysql will be slower, so planning to implement the same methodology but that should be very fast. Which data structure can be used? In my previous thread i have already asked about B Tree and got very good reply but now my planning is to implement the same methodology as used in mysql for key retrieval. Thanks in advance.
Mar 23 '09 #1
5 2463
gpraghuram
1,275 Recognized Expert Top Contributor
Then you can use memorymap in which and you can maintaina map with key and position so that you can easily retreive the values.

raghu
Mar 24 '09 #2
Man4ish
151 New Member
@gpraghuram
Can i retrieve the value with less than a given value if yes then how we can implement it.
Mar 24 '09 #3
Man4ish
151 New Member
[quote=Man4ish;3475178]I have one example. I have one data of only supervisor in company for past 50 years.

Supervisor Joining_date leaving date height
A.M kadik 23/2/51 23/4/57 165
M.A. Khan 25/4/57 2/02/64 179
R. A. Sharma 3/02/64 05/09/79 169
K.Kandaswamy 6/09/79 07/07/91 174
R.A.Brown 09/07/91 09/08/2000 165


I need to get data (name ,height and data of joining) for all the supervisors which were there in period 2/02/71 to 03/05/95. This is very easy in mysql but how efficiently this can be done in C/C++.Since MySQL uses the B+ Tree structure. Can B+ Tree be used here?if yes how? I have no idea at all.Thanks in advance.

Regards
Manish
Mar 24 '09 #4
gpraghuram
1,275 Recognized Expert Top Contributor
The data can be in any format.
But if u want to retreive values with some specific logic then you have to maintain keys accordingly.
You can maintain one map with name as the key and the position.
You can maintain a second map with the age as key or the period of stay and position.
So when retreiving you have to use the right map and then get the values accordingly.

raghu
Mar 25 '09 #5
Man4ish
151 New Member
@gpraghuram
Thank you very much for your answer. For small file it seems ok. but if i have a file of around 100MB then i have to read the whole file sequentially which may reduce the speed. How this can be done randomly?
Thanks in advance.
Mar 26 '09 #6

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

Similar topics

2
by: BT3 | last post by:
I am trying to replace a single record in a flat file. The file is relatively small and no need for database. I open the file, and save the ftell() value in a variable. I read a record using...
0
by: Jean Hagen | last post by:
I'm trying to write a script to weekly remove MySQL logs, the general, error and binary log files. Following the MySQL documentation, I've written a script that moves all current log files, then...
5
by: Boo | last post by:
Can someone explain to me why this simple query will not use an index on the field confirm_date? select * from comments where confirm_date != 0 confirm_date is an integer, and I have a regular...
13
by: raykyoto | last post by:
Hi all, I'm sure this is a popular question that comes up every few months here. Indeed, I've looked at some of the past postings, but I would like to ask things differently. Basically, I'm...
3
by: Cynthia | last post by:
Hi all, I know this can be done, but I just can't seem to find a way to do it (that I can use myself, or understand). I use Mac and I've got some databases on my hosting company's MySql server...
85
by: Russ | last post by:
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the...
9
by: FFMG | last post by:
In my site I have a config table, (MySQL), with about 30 entries; the data is loaded on every single page load. This is not the only call to the db, (we do a total of about 8 calls to the db). As...
5
by: Gorilla3D | last post by:
I've writing my own flat file database.. well table-based pure php code, PhpSimpleDb but I was looking into some bench marking so was wonder if anyone knew any other flat-file php db's out there. ...
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.