Efficient map looking table

From: Yoann MOREAU <yoann(dot)moreau(at)univ-avignon(dot)fr>
To: pgsql-general(at)postgresql(dot)org
Subject: Efficient map looking table
Date: 2012-01-10 21:44:32
Message-ID: 20120110224432.55686vbzcct9c85c@webmail.univ-avignon.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hello, I store in a database some XML-tag data. I have one table for
the tag names with an int PK for each unique name (tag_names) and one
table for the tags (tags) where each row references a tag name. The
tag_names table is not big but the tags table is huge. When I insert a
row in tags I have to check if its tag name already exists to get its
id_tag_name and if not insert it in tag_names.

My question : is there an efficient way to check/get the tag_name,
it's doing the same job as a hashmap. I need it to be up to date in
the database when inserting new tag names, because different inserts
in tags table could occur at the same time, all checking for a tag
name. I then would need the whole tag_names table to be loaded in
memory and in the most "map" way as possible, is there anything
special to do ?

Thanks !
Yoann Moreau

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-01-10 21:52:16 Re: string = any()
Previous Message Filip Rembiałkowski 2012-01-10 21:27:01 Re: string = any()