473,608 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Efficient Storage of IP Address

Greetings,

I am establishing a database for the purpose of logging access to my secure
webserver and am wanting to make the database as efficient as I can because
it will be doing a lot of work when the site goes live.

What is the most efficient way in a MySQL table to store remote IP
addresses? What data type should I use? Should I just go with a basic
VARCHAR(15) to allow for 4 sets of 3 digits with 3 decimal separators, or is
there a better way?

Thanks,

Vance
Sep 15 '05 #1
2 8476
Vance M. Allen wrote:
I am establishing a database for the purpose of logging access to my
secure webserver and am wanting to make the database as efficient as I
can because it will be doing a lot of work when the site goes live.

What is the most efficient way in a MySQL table to store remote IP
addresses? What data type should I use? Should I just go with a
basic VARCHAR(15) to allow for 4 sets of 3 digits with 3 decimal
separators, or is there a better way?


http://dev.mysql.com/doc/mysql/en/mi...functions.html

Have a look at INET_ATON & INET_NTOA

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Sep 15 '05 #2
>I am establishing a database for the purpose of logging access to my secure
webserver and am wanting to make the database as efficient as I can because
it will be doing a lot of work when the site goes live.

What is the most efficient way in a MySQL table to store remote IP
addresses?
Define "efficient" for this application. Is "efficient" = "uses the least
disk space"? Or is "efficient" = "uses the least CPU time"?
What data type should I use? Should I just go with a basic
VARCHAR(15) to allow for 4 sets of 3 digits with 3 decimal separators, or is
there a better way?


You could use inet_ntoa() and inet_aton(). These save disk space.
They might possibly save disk i/o due to a smaller index or smaller
data. However, they use CPU time. How many times will you need to
convert these? Do you need to do subnet masking?

Gordon L. Burditt
Sep 15 '05 #3

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

Similar topics

4
1737
by: sebsauvage | last post by:
Hello. In one of my programs ( http://sebsauvage.net/python/webgobbler/ ), I have a global dictionnary containing the whole program configuration. Sample follows: CONFIG = { "network.http.useproxy" : True, "network.http.proxy.address": "proxy.free.fr", "network.http.proxy.port" : 3128 }
6
1404
by: Mike O. | last post by:
What's the most efficient way to store small messages (similar in size to a short email) on the client without using a database? I need to be able to store thousands possibly. I was thinking of C# classes serialized to XML? How efficient would this be and what other alternatives are there? Thanks in advance!.
7
2461
by: smith4894 | last post by:
Hello, I have a question regarding storage locations for different data types. For example, dynamically created objects (using "new") are created on the heap. local objects ( foo() {int x;} ) are on the stack. 1)Where are global non-const objects created? 2)Where are global const objects created?
2
3711
by: Thomas Paul Diffenbach | last post by:
I'm trying to write a space efficient string (nul terminated array of char), storing the characters directly unless the number of characters is too large to be so stored, and storing a pointer to other storage otherwise. Rather than lose space to padding by just using a sentinal bool to indicate which member of the union has been written to, I want to overload the last character of the directly stored string as the sentinal.
13
1644
by: S.Tobias | last post by:
I'm examining the existence of temporary objects by looking at their addresses. The trick is to create a structure that contains an array as its first member. In an expression the array rvalue is converted to a pointer to its first member. Since this address is also the address of the array, and that is the address of the structure, I conclude that this is also the address of the temporary storage for the structure (r)value. I'm...
9
2423
by: CptDondo | last post by:
I am working on an embedded platform which has a block of battery-backed RAM. I need to store various types of data in this block of memory - for example, bitmapped data for control registers, strings for logging, and structures for data points. I want to use one function to read data from this block and one function to write data, for example: sram_read(OBJECT_IDENTIFIER) would return a pointer to the appriate object and
14
2115
by: Richard Harter | last post by:
Apologies for the length - this post is best viewed with fixed font and a line width >= 72. Below is the source code for a C header file that provides a suite of storage management macros. I am asking for comments on it. In particular: Are there any gotchas that I have overlooked? Are there any suggestions for improvements? Is there a generally available superior packages to do the same thing with the same general licensing? ...
21
1996
by: py_genetic | last post by:
Hello, I'm importing large text files of data using csv. I would like to add some more auto sensing abilities. I'm considing sampling the data file and doing some fuzzy logic scoring on the attributes (colls in a data base/ csv file, eg. height weight income etc.) to determine the most efficient 'type' to convert the attribute coll into for further processing and efficient storage... Example row from sampled file data: , ....]
5
1601
by: kanalkannan | last post by:
Hi, I have heard a question in C data storage i want to know where the auto,static and global variables are get stored and what are the memory segments like stack heap and its allocation. waiting for reply.
0
8498
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8478
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8152
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6817
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3962
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4025
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
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
1
1598
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1331
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.