table design and data type choice

From: Jayadevan M <maymala(dot)jayadevan(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: table design and data type choice
Date: 2014-01-08 07:11:14
Message-ID: CAFS1N4hQKcTzVZrxpDrv0KrsiqQbecvOK4GAAEks2uWCnTCOBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

We have a table to record the voteup/votedown by users of questions and
answers (like on stackoverflow). So there will be a large number of inserts
(voteup/down), some updates(user changes mind)and may be a few deletes. The
queries will be mostly aggregates (count(*) where question_id=<x> and
vote_up =1) . Is it better to have data type of Boolean, varchar or int?

I assume there isanother decision too - have 2 columns - one for up and one
for down, or have just one column which will be 1 or -1.

Regards,
Jayadevan

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sameer Kumar 2014-01-08 10:31:17 Re: table design and data type choice
Previous Message Rajeev rastogi 2014-01-08 03:56:57 Re: Consistent file-level backup of pg data directory