Skip site navigation (1) Skip section navigation (2)

arrays vs. columns

From: Mark Nelson <MCN(at)cc(dot)usu(dot)edu>
Subject: arrays vs. columns
Date: 2002-11-25 16:50:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

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

Anybody have any advice?



pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group