Grokbase
Topics Posts Groups | in
x
[ help ]

Just Someone (just...@gmail.com)

Profile | Posts (25)

User Information

Display Name:Just Someone
Partial Email Address:just...@gmail.com
Posts:
25 total
25 in PostgreSQL - General

5 Most Recent

All Posts
1) Just Someone Re: Schema search_path and views
| +1 vote
Cool! That explains it fully. So i guess there will be a better performance to the pre-generated...
PostgreSQL - General
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Cool!

That explains it fully. So i guess there will be a better performance
to the pre-generated views at the price of more views.

Thanks!


On 11/6/06, Merlin Moncure <mmoncure@gmail.com> wrote:
> On 11/6/06, Just Someone <just.some@gmail.com> wrote:
> > I have a database with multiple schemas all with the same structure
> > (but of course different data...).
> >
> > I want to create a view that will be created in a shared schema, and
> > when executed will be executed against the current schema. Whenever I
> > try it, it seems the view is linked to a specific schema used when
> > creating it, and doesn't reevaluates based on the current schema.
>
> no, or not exactly. views resolve the search path when they are
> generated. this is a fundemental part of how they work. functions,
> however, are a bit different. the plans are lazily generated and
> 'stick' to the tables that are resolved in the search path when the
> plan is generated, which is basically the first time you run them in a
> session. so, you could in theory do what you want with a view if it
> called functions for all the switchable parts.
>
> merlin
>


--
Family management on rails: http://www.famundo.com - coming soon!
My development related blog: http://devblog.famundo.com
2) Just Someone Schema search_path and views
| +1 vote
I have a database with multiple schemas all with the same structure I want to create a view that...
PostgreSQL - General
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
I have a database with multiple schemas all with the same structure
(but of course different data...).

I want to create a view that will be created in a shared schema, and
when executed will be executed against the current schema. Whenever I
try it, it seems the view is linked to a specific schema used when
creating it, and doesn't reevaluates based on the current schema.

Here is the pseudo structure/code:

schema1:
=======
create table t1 ...

schema2:
=======
create table t1 ...

shared_schema:
============
create table t3 ...

create the view:
===========
set search_path to shared_schema, schema1;
create view view1 as select * from t1;

try the view:
========
set search_path to shared_schema, schema1;
select * from view1;
set search_path to shared_schema, schema2;
select * from view1;

Results:
======
In the above, both select * from view1; will return the same data,
though the search path changed.

Is there a way to make the view use the current search_path?



--
Family management on rails: http://www.famundo.com - coming soon!
My development related blog: http://devblog.famundo.com
3) Just Someone Re: using schema's for data separation
| +1 vote
I am using a similar solution, and I tested it with a test containing 20K+ different schemas....
PostgreSQL - General
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
I am using a similar solution, and I tested it with a test containing
20K+ different schemas. Postgres didn't show slowness at all even
after the 20K (over 2 million total tables) were created. So I have
feeling it can grow even more.

Guy.



On 9/28/06, snacktime <snacktime@gmail.com> wrote:
> I'm re evaluating a few design choices I made a while back, and one
> that keeps coming to the forefront is data separation. We store
> sensitive information for clients. A database for each client isn't
> really workable, or at least I've never though of a way to make it
> workable, as we have several thousand clients and the databases all
> have to be accessed through a limited number of web applications where
> performance is important and things like persistant connections are a
> must. I've always been paranoid about a programmer error in an
> application resulting in data from multiple clients getting mixed
> together. Right now we create a schema for each client, with each
> schema having the same tables. The connections to the database are
> from an unprivileged user, and everything goes through functions that
> run at the necessary privileges. We us set_search_path to
> public,user. User data is in schema user and the functions are in the
> public schema. Every table has a client_id column.
>
> This has worked well so far but it's a real pain to manage and as we
> ramp up I'm not sure it's going to scale that well. So anyways my
> questions is this. Am I being too paranoid about putting all the data
> into one set of tables in a common schema? For thousands of clients
> what would you do?
>
> Chris
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>


--
Family management on rails: http://www.famundo.com - coming soon!
My development related blog: http://devblog.famundo.com
4) Just Someone Re: SELinux + CREATE TABLESPACE = ?
| +1 vote
If you rather keep SELinux on, you can still set the SELinux context on the directory where you...
PostgreSQL - General
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
If you rather keep SELinux on, you can still set the SELinux context
on the directory where you want the tablespaces to one postgres will
like.

To find what is the permissions you need, you can use ls -Z. It will
list the SELinux context. Check /var/lib/pgsql/data (or wherever
postgres data is pointing to), and then set this same permission on
the target dir using chcon.

For example, on my FC4 system all subdirectories on the data directory have:
root:object_r:postgresql_db_t or user_u:object_r:postgresql_db_t

So if you want to chage /path/to/foo/which/is/not/under/pgdata, run
(as root or sudo):

chcon root:object_r:postgresql_db_t /path/to/foo/which/is/not/under/pgdata

This way postgres can access it, and you get the SELinux security.

Bye,

Guy.

http://www.famundo.com
http://devblog.famundo.com
- Hide quoted text -


On 8/2/06, David Fetter <david@fetter.org> wrote:
> On Wed, Aug 02, 2006 at 04:47:36PM -0700, David Fetter wrote:
> > Folks,
> >
> > This may have come up before, but I didn't see a specific answer in
> > the archives.
> >
> > When I try to do:
> >
> > CREATE TABLESPACE foo LOCATION '/path/to/foo/which/is/not/under/$PGDATA';
> >
> > I get:
> >
> > ERROR: could not set permissions on directory "/path/to/foo/which/is/not/under/$PGDATA"
> >
> > Apparently this is a SELinux problem. How do I set the policy to
> > allow for this, or if that's not possible, how do I disable SELinux?
> >
> > Thanks in advance :)
>
> Pardon my self-followup for the archives :)
>
>
> Thanks to Talha Khan, who said:
>
> >    setenforce 1;
> >
> >    will disable SELINUX
>
> Thanks also to Clodoaldo Pinto, who said:
>
> > >Apparently this is a SELinux problem.
> >
> > Confirm it looking for a message in /var/log/messages.
> >
> > >How do I set the policy to allow for this,
> >
> > This Fedora FAQ is good:
> > http://fedora.redhat.com/docs/selinux-faq-fc5/#faq-div-controlling-selinux
> >
> > >or if that's not possible, how do I disable SELinux?
> >
> > edit /ect/selinux/config
>
> Cheers,
> D
> --
> David Fetter <david@fetter.org> http://fetter.org/
> phone: +1 415 235 3778        AIM: dfetter666
>                               Skype: davidfetter
>
> Remember to vote!
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
5) Just Someone Re: A better AND query?
| +1 vote
The schema can change, but I rather not. The use case is a web app where you can tag items with...
PostgreSQL - General
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
The schema can change, but I rather not.

The use case is a web app where you can tag items with tags
(many-2-many). There are multiple items you can tag: contacts,
schedules, lists, etc... And then you can search and categorize by
tags. The standard for this if you look aroung the web is to retrieve
the tagged records with any of the tags you select. Effectively an OR
query.

What I'm trying to do is search for items matching multiple tags at
the same time - and AND query. So that I can bring up all contacts
that are tagged with friends and movie-lovers.

Hope that clears it up a bit...

Guy.


On 5/9/06, Wayne Conrad <wconrad@yagni.com> wrote:
> > tagged_type int -- points to the table this tag is tagging
>
> My head exploded right about here. Is the schema written in stone, or
> can it change?
>
> What is the use case for this schema? What's it for? What is a "tag"
> about?
>
> Best Regards,
>         Wayne Conrad
>


--
Family management on rails: http://www.famundo.com - coming soon!
My development related blog: http://devblog.famundo.com

spacer
Profile | Posts (25)
Home > People > Just Someone