Fast identifiers table creation - Mailing list pgsql-novice

From Vincent Michel
Subject Fast identifiers table creation
Date
Msg-id 201106301833.10021.vincent.michel@logilab.fr
Whole thread Raw
List pgsql-novice
Hi all,

I have a simple problem, but don't know any simple solution for it.

I have a list of (millions) of couple (url1, url2), where url1 and url2 are
strings. I have imported this list in a table "urls" by COPY FROM.

In the same time, I have a table "idurl" (id integer, url string) that gives
me a correspondence between an url and an identifier (also millions of
different urls).
I would like to create a new table (id1, id2), each row of this table being
the couple of identifiers corresponding to a couple of urls from the table
"urls".

I have tried OUTER JOIN:

CREATE tmp1 (id integer);
INSERT INTO tmp1 (id) SELECT idurl.id FROM urls LEFT OUTER JOIN idurl
ON (url.url1 = idurl.url);

and I have done the same thing with another table tmp2.
But this takes a while, and I have the problem of combining the resulting
tables tmp1 and tmp2.

Another solution that I have tried, is to create a index on url in the table
idurl, but this take lots of space in memory.


I know that there is no miracle solution, but if someone has a better
solution...

Thanks !

-Vincent

pgsql-novice by date:

Previous
From: Mäggi Hieber
Date:
Subject: change data type 'money' to '€'
Next
From: Ognjen Blagojevic
Date:
Subject: Re: [NOVICE] change data type 'money' to '€'