Re: [GENERAL] Crosstab SQL Question

2000-06-15 Thread Cary O'Brien

> > > Is it possible to perform a crosstab query in postgres similar the
> > > functionality that MS Access provides?
> > >
> > > I tried building the query in Access (against postgre 6.5.3 using ODBC)
> > > and using the SQL created by Access, but it looks like very non-standard
> > > SQL code and postgre doesn't support it.
> > 
> > ...[gratuitous sarcasm snipped]...
> > you might want to describe what a crosstab query is...
> 
> A crosstab is also known in MS Excel as a "pivot table", if that helps
> any.  It facilitates drag-and-drop data analysis by creating arbitrary
> 2-D matrices aggregated from data columns.  Very cool, and hard to
> adequately describe, as it makes some complex operations very simple, and
> I don't understand how it works underneath.  IMO, it is one of the most
> powerful data analysis tools in existence.  It would be neat to be able
> to do something similar in pgsql...
> 

Applix has something called TM1 that does this.  They have a (ug)
flash demo and some more documentation at

http://www.applix.com/itm1

It used to be available for Linux, but with the big reorg, who
knows.

-- cary



Re: [GENERAL] Re: [SQL] oracle rownum equivalent?

2000-06-08 Thread Cary O'Brien

> At 06:47 PM 6/7/00 -0400, Cary O'Brien wrote:
> >
> >> thanks for the response.  oid is equivalent to oracle rowid.  
> >
> >I think there is a fundamentel difference between oid and rownum.
> >Oid is just a serial number.  Rownum is a long string that tells
> >oracle where exactly the row is.  So *I think* rownum can be
> >used for fast lookups, where oid, unless indexed, can't.
> >
> >Other than that they are the same pretty much.
> >
> >-- cary
> >
> 
> i'll have to respectfully disagree with you on your interpretation of
> rownum.  
> in oracle, rownum tells only the relative position of a row in a result set.
> also, it is an integer value starting at 1 up to nrows retrieved and is used,
> for the most part, to limit the result set and not for fast lookups.  it also 
> can be used in a DML statement within a function, such as mod(), to aid in
> generating a value.  the point here is moot though, as postgres doesn't have 
> an equivalent and i'll have to learn to live without that small piece of 
> oracle and enjoy what i see as the greater benefits of postgres.  
> 


Arrg.  That's what I get for emailing late at night without checking
(my Oracle book is in the office).  Where I typed rownum I meant
rowid.  You are 100% correct about rownum.  You can use rownum for
things like

select * from foo where rownum <= 20

Where in postgresql you would say

select * from foo limit 20

What I meant to say, and failed, was that in Oracle, rowid
"psuedo-column" are hex encoded strings containing the block, row, and
file where the tuple is stored.  So lookup on unindexed rowid *should*
be fast, although this is not spelled out in my ancient Oracle book.
If you want a PostgreSQL lookup using oid to be fast, you need an
index, I think.

PostgreSQL oid is kind of like, but not exactly the same as either
oracle rownum or oracle rowid.

Sorry for the confusion.

-- cary



Re: [GENERAL] Re: [SQL] oracle rownum equivalent?

2000-06-07 Thread Cary O'Brien


> thanks for the response.  oid is equivalent to oracle rowid.  

I think there is a fundamentel difference between oid and rownum.
Oid is just a serial number.  Rownum is a long string that tells
oracle where exactly the row is.  So *I think* rownum can be
used for fast lookups, where oid, unless indexed, can't.

Other than that they are the same pretty much.

-- cary