Forum Moderators: coopster

Message Too Old, No Replies

CSV or binary query for best performace?

         

cameraguy

3:48 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



Hello MySQL experts,

I am using a commercial database from MaxMind to find the city of an IP address. MaxMind suggest in their website to use their API to query the city:
"We have two formats available for download, Binary and CSV. For the larger databases such as the City and Organization databases, the performance of the Binary format with our APIs is significantly faster than the CSV format imported into SQL. Lookups against binary database using our APIs can be up to hundreds or thousands times faster than using the CSV database."

Yet, a database expert suggested to me that a MySQL query may be much faster.

As I am making hundreds of queries/second (with several clustered servers) I need to most performing solution. FYI, the binary file is 22MB large and the CVS file 90MB. (My understanding is that the CVS file is much larger but is handled like tables, while the binary file (.dat) is smaller, but is accessed every time there is a query...)

What's your opinion? What would be the fastest solution? Thank you for your help.

vacorama

4:33 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



it shouldn't matter too much if a file needs accessing everytime. most systems, especially *nix have ways of keeping frequenlty used files ready for fast access in memory. have you done any indexing on your DB yet? that should show a lot of improvment off the bat if it is indexed according to the most used query fields...

vacorama

4:37 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



oh im sorry, i mis-read your question... i would think the binary would be much faster no matter what.

kkobashi

5:07 pm on Apr 12, 2006 (gmt 0)



If you can, keep your result sets in-core on the database server to reduce paging and disk hits.

jatar_k

5:24 pm on Apr 12, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



my understanding of that snippet is that you don't use the binary, you access it through their API's on their server?

is that right? or do they provide you with the API which you can put on your own servers?

if it is a comparison with both options placed on your own servers then I think the binary would be faster

but

download both and test it ;)

cameraguy

10:52 am on Apr 13, 2006 (gmt 0)

10+ Year Member



Thank you all for your input.

jatar_k:
MaxMind provides the scripts to make the queries, but the .dat file is on my server. Do you still believe that this is the best solution?

jatar_k

3:52 pm on Apr 13, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



yes, I would think the binary would be faster, but as I said, you could try both and see.