An extremely large hash lookup mechanism [message #172232] |
Mon, 07 February 2011 12:06  |
ram
Messages: 4 Registered: February 2011
Karma: 0
|
Junior Member |
|
|
I have Mysql table with customerid (big int) & customer_unique_key
(varchar )
I have a php script that needs to upload customers into groups.
The customer_unique_key will be uploaded and all the customerids
should be entered to a new table.
Initially My script was doing a per-record query to extract
customerid and print.
But this turned out to be toooo slow , since the upload file may have
upto a million records.
Now I modified the script to read all customer_unique_key ->
customerid as key value pairs into an array
This works fine and fast , but hogs the memory and crashes whenever
the number of records crosses around 3-4 million.
What is the best way I can implement a hash lookup ? Should I use a
CDB library ?
|
|
|
Re: An extremely large hash lookup mechanism [message #172233 is a reply to message #172232] |
Mon, 07 February 2011 13:15   |
Peter H. Coffin
Messages: 245 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On Mon, 7 Feb 2011 04:06:30 -0800 (PST), ram wrote:
> I have Mysql table with customerid (big int) & customer_unique_key
> (varchar )
>
> I have a php script that needs to upload customers into groups.
> The customer_unique_key will be uploaded and all the customerids
> should be entered to a new table.
>
> Initially My script was doing a per-record query to extract
> customerid and print.
> But this turned out to be toooo slow , since the upload file may have
> upto a million records.
>
> Now I modified the script to read all customer_unique_key ->
> customerid as key value pairs into an array
> This works fine and fast , but hogs the memory and crashes whenever
> the number of records crosses around 3-4 million.
>
>
> What is the best way I can implement a hash lookup ? Should I use a
> CDB library ?
No, you should use a real database. Unless you plan on essentially never
adding a customer. But the way you've framed the question (including
babbling about hashes) makes it sound like you've already "solved" your
problem, and have decided you want to use cdb. So, you might as well
have at it, find out that it's not fixing your problem, then go back to
comp.databases.mysql again, and this time start with talking about your
problem instead of asking how to implement your solution.
--
5. The artifact which is the source of my power will not be kept on the
Mountain of Despair beyond the River of Fire guarded by the Dragons
of Eternity. It will be in my safe-deposit box. The same applies to
the object which is my one weakness. --Peter Anspach "Evil Overlord"
|
|
|
|
|
|
|
|
|
Re: An extremely large hash lookup mechanism [message #172250 is a reply to message #172248] |
Tue, 08 February 2011 07:06   |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 2/8/2011 6:38 AM, Ram wrote:
> Sorry
> I sure can use a nntp client ... but I dont know which server would allow me to post.
Call your ISP?
Or maybe ask somewhere, eg in here.
I am sure many will be happy to help you with such a problem, even when
it is totally off-topic, if that results in less useless threads.
> Google is quiet a convenient interface .. I know it may still be messing up the usenet style , but I believe folks at google are working hard to make it a standard.
>
If you think that Googlegroups gives you a convenient interface, I think
our tastes differ.
You seem to be unfamiliar with even the most basic usenet conventions,
like quoting what it is you are responding too. So I wonder if you
actually ever used a serious newsreader.
About Google working hard on their usenet interface: Whahahaha!
Excuse me. That was funny.
If the good folks at Google really cared they would have produced
something that worked, long ago.
And since I don't believe they lack competent programmers, I can only
conclude they must lack the will to improve it.
Regards,
Erwin Moller
PS: Did you notice you started yet another fresh (top)thread?
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|
|
Re: An extremely large hash lookup mechanism [message #172254 is a reply to message #172248] |
Tue, 08 February 2011 13:14  |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
El 08/02/2011 6:38, Ram escribió/wrote:
> I sure can use a nntp client ... but I dont know which server would allow me to post.
There're several services available ranging from free to cheap. I
particularly enjoy http://www.eternal-september.org
> Google is quiet a convenient interface .. I know it may still be
> messing up the usenet style , but I believe folks at google are
> working hard to make it a standard.
That's exactly the problem: they'd love their system to become the
de-facto standard, just like IE6 become the de-facto standard for HTML
(and managed to slow down the world wide web for years).
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
|