From: R D <mrk279@yahoo.com>
To: pgsql-admin@postgresql.org
Subject: Indexes and Views
Date: Sat, 24 Feb 2001 03:22:53 -0800 (PST)
Message-ID: <20010224112253.1319.qmail@web10012.mail.yahoo.com> (raw)
Hi PostgreSQL folks,
I would like to know is there any way to use indexes
with the views or rules in this situation:
cteate table test1(col1 int,col2 int,col3 int);
insert into test1 .....;
..............
insert into test1 .....;
create index test1_col1_col2 on test1(col1,col2);
create view test1_view as
select col1/1000.0,
col2/1000.0,
col3/10.0
from test1;
i'm storing col1 to col3 as integers to save storage
space(infact they are fixed point).I have many tables
ctrated using this template only the view devidor
constants are different for each table. Here they are
1000.0 1000.0 and 100.0 but for every table they are
different. I would like to be able to execute the
queryes like this using the index:
select * from test1_view
where col1=const1 and col2=const2;
select * from test2_view
where col1=const1 and col2=const2;
and etc.
not like this
select * from test1_view
where test1.col1=const1*1000
and test1.col2=const2*1000;
select * from test2_view
where test2.col1=const1*col1_dividor
and test2.col2=const2*col2_dividor;
I do not want the user application to know and to deal
with this table specific constant dividors.
So can I create some rules to be able to do this?
Is it possible to use index in this situation at all?
Is there any other way to get the same results?
I cheked the docs but could not find any solution.
Sorry for the long and badly formuled introduction !
Hopeing you will help me!
best regards,
Rumen
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mrk279@yahoo.com
Subject: Re: Indexes and Views
In-Reply-To: <20010224112253.1319.qmail@web10012.mail.yahoo.com>
References: <20010224112253.1319.qmail@web10012.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox