Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6727327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:02:13+00:00 2026-05-26T10:02:13+00:00

I’m trying to implement my own triplestore ontop of a SQL database (yes I

  • 0

I’m trying to implement my own triplestore ontop of a SQL database (yes I know there are finished projects out there) and I’m trying to decide on the best way to implement a symbolic “atom”.

In a naive design, we might implement a triplestore in SQL by creating a single “triple” table with three varchar columns called subject, predicate, object. To save space I was going to create an “atom” table, that would store the unique text used in any subject/predicate/object field, and change those fields to foreign keys linking back to the atoms that contain their text.

However, I see a couple ways to implement the Atom table.

  1. Store the text as a varchar.

    • Pros: Simple to index and enforce uniqueness of the text.
    • Cons: It could not store arbitrarily large text.
  2. Store the text as a text blob, as well as a hash of the text to use when querying and enforcing uniqueness.

    • Pros: Could store arbitrarily large text.
    • Cons: A little more complicated. Possibly, albeit rare, hash collisions depending on the hashing algorithm (md5, sha, etc).

Which is the better approach in terms of performance, long-term reliability, and ability to store any type of data? If I use a hash, is there a valid concern about collisions? Even if collisions are rare, it would only have to happen once to corrupt triplestore.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:02:13+00:00Added an answer on May 26, 2026 at 10:02 am

    Don’t waste any time trying to optimize this until you can prove that it’s a bottleneck and is the most important thing to fix.

    “To save space…” don’t. Space is almost free. Unless you have over a terabyte of data, you don’t have much to worry about. You can easily waste more time thinking about storage than the storage is worth.

    The varchar solution will work and scale fine. The idea of a “string pool” or “atom table” is actually a good one because you’ll have lots of references to the same underlying object. Why repeat the varchar? Why not just repeat an index number?

    “Arbitrarily large text” is a strange requirement. Why bother?

    A blob will be generally be slower. The hash collision — while little more than a theoretical concern — is something you handle two ways. First, use a hash with more than 32 bits. Second, a collision won’t corrupt anything unless you (foolishly) fail check the actual blobs to see if they’re actually the same. If you want to avoid comparing the entire blob to confirm that there’s no collisions, keep two hashes by different algorithms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am trying to render a haml file in a javascript response like so:
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.