> I'm logging IP addresses and also searching for existing ones. Does
> anyone happen to know which is more resource intensive: storing the
> IP's as integers using INET_NTOA() and INET_ATON() to convert them at
> each query; or simply storing the IP as a varchar? In each case the
> IP field would be the primary key.

I'm actually doing this but with Apache access log files.  I tested both
methods and found that the INET_NTOA() and INET_ATON() were fairly quick and
didn't have much of a performance hit.  I also tested the queries for
pulling the ips back out.  Using the ints vs the ips.  Both were indexed,
which made the insert a little slower but drastically improved the search.
The ints were a bit faster on the search than the varchar ips, but in my
case there wasn't a huge difference and I would rather not have to do the
extra processing and extra space for storing the ips as ints and index them
as I only run reports off the access log once a week.

One thing I might suggest is to find how many rows you really need to run
your reports (or dates etc whatever it may be).  The smaller your row size
the faster your searches will be and the fewer indexes you have the faster
your inserts will be.  You could just archive what you don't need into
another table/database and mess with the indexes and run your reports.

Hope that helped. :)

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to