473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Postgres inherited table, some questions...

Hello,

I am playing with the "INHERITS" functionality of create table to
determine its suitability to my needs and I've hit a roadblock (hopefully
minor)...

If I have two tables like this:

CREATE TABLE tablea (
id SERIAL
);

CREATE TABLE tableb () INHERITS (tablea);

#1. Now first of all, I notice that if I insert something into tableb, it
appears in tablea and if I insert something in tablea, it does not appear
in tableb... Is this correct and will the use of the "SERIAL" type
cause any confusion or can I insert rows in each table without being
concerned about any internal ramifications of this?

#2. If I do "explain select id from tablea where id=4", I get something
like this:

QUERY PLAN
-------------------------------------------------------
Seq Scan on jobdata (cost=0.00..1.04 rows=1 width=4)
Filter: (id = 4)
....If, however, I do "explain select id from tableb where id=4":

-------------------------------------
------------------------------------------------
Result (cost=0.00..2.08 rows=2 width=4)
-> Append (cost=0.00..2.08 rows=2 width=4)
-> Seq Scan on jobdata_revisions (cost=0.00..1.04 rows=1 width=4)
Filter: (id = 4)
-> Seq Scan on jobdata jobdata_revisions (cost=0.00..1.04
rows=1 width=4)
Filter: (id = 4)
I'm a bit mystified by the results of tableb, I don't understand what the
"Append" and the second "Seq Scan" is for... More importantly, I'm not
sure how to optimize this properly...

Any ideas what I can do here?...

Thanks!

- Greg


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #1
0 940

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: alreva | last post by:
hi I have inherited from Datagrid Class and just add a new method there. while using this new inherited calss in a master-detail mode (master Grid and detail grid) I used a datatable as the master...
0
by: zerobearing2 | last post by:
Hi all- I'm migrating to postgres from the MS SQL Server land, as I can see a great potential with postgres, I was wondering if anyone has experimented or started a project with XML inside user...
5
by: Alex Page | last post by:
I've been trying to extend Postgres and create an enumerated type to represent gender, as a precursor to more complex enumerated types. I've created the C functions for input and output with the...
3
by: Darkcamel | last post by:
Hello all, I am new to postgres and don't really understand how the database is set-up. I am very fluent with mysql and sql2000, but postgres is new to me. If anyone can point me to some good...
1
by: Esteban Kemp | last post by:
This is the Problem: I'm building a Large DataMart with a big table and I want to improve the performace using aggregates I mean a set of table that store some specific aggregacion of the main...
10
by: Hank | last post by:
We have just recently migrated the data from our Access 2000 backend to Postgres. All forms and reports seem to run correctly but, in many cases, very slowly. We do not want to switch over until...
1
by: Jack Orenstein | last post by:
I'm trying to configure PHP 5.2.0 with support for Postgres 8.1.3. Postgres was installed with FC5 without source. PHP's configure needs source. When I run configure: configure: error: Cannot...
0
by: NM | last post by:
Hello, I've got a problem inserting binary objects into the postgres database. I have binary objects (e.g. images or smth else) of any size which I want to insert into the database. Funny is it...
1
by: sainathr | last post by:
Hi, I would like to run shell scripts with respect to the time mentioned in postgres data base tables. Postgres database should trigger the shell script for the time mentioned in the table. To...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.