arrays vs. columns

From: Mark Nelson <MCN(at)cc(dot)usu(dot)edu>
To: PGSQL-NOVICE(at)POSTGRESQL(dot)ORG
Subject: arrays vs. columns
Date: 2002-11-25 16:50:24
Message-ID: 01KPA3RXIMKY91X18G@cc.usu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I'm wondering about the efficiency of using an array in a single
cell vs. making a table with lots of columns (like 50-70).

Here's what I'm doing. I'm working on an application where a user
goes through a program that has between 50 and 70 pages and it is
critical to know which pages the user has been to, and how many
times. Something of an accurate counter, but one that can
distinguish between users. So each time a user goes to a page, a
number is incremented for that user on that page.

I could either make a table with columns for each individual
page and when the user hits the page, it sends the query to the
table incrementing the field for that user, or I could have a
table where there is one column that holds an array with all the
pages and their related counts. The second option means I would
be updating that one cell for each page visited. But I seem to
have read somewhere that if you are going to make lots of updates
to an array, it is better to put the array items in their own
columns.

Anybody have any advice?

/mark

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Dennis King 2002-11-25 19:03:56 Tools: schema designer; scripts
Previous Message Patrick Hatcher 2002-11-25 16:29:33 Re: graphics display