Re: [HACKERS] Add a filed to PageHeaderData
On Tue, Jun 24, 2014 at 10:18 PM, Pavan Deolasee pavan.deola...@gmail.com wrote: On Tue, Jun 24, 2014 at 3:40 PM, Kevin Grittner kgri...@ymail.com wrote: Soroosh Sardari soroosh.sard...@gmail.com wrote: I check this problem with a virgin source code of postgresql-9.3.2. So the bug is not for my codes. By the way, following code has two different output and it is weird. I can confirm that I see the difference in 9.3.2, and that I don't see the difference in 9.3.4. Upgrade. http://www.postgresql.org/support/versioning/ There's really no point in reporting a possible bug on a version with known bugs which have already had fixes published. FWIW I can reproduce this on HEAD with the attached patch. I could reproduce this on a 64-bit Ubuntu as well as 64-bit Mac OSX. Very confusing it is because I tried with various values for N in char[N] array and it fails for N=20. Other values I tried are 4, 12, 22, 24 and the test passes for all of them. The logic for trying other values is to see if pd_linp[] starting on un-aligned boundary can trigger the issue. But there seem to be no correlation. postgres=# select version(); PostgreSQL 9.5devel on x86_64-apple-darwin13.2.0, compiled by Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn), 64-bit postgres=# -- test SP-GiST index that's been built incrementally postgres=# create table test_range_spgist(ir int4range); postgres=# create index test_range_spgist_idx on test_range_spgist using spgist (ir); postgres=# insert into test_range_spgist select int4range(g, g+10) from generate_series(1,586) g; INSERT 0 586 postgres=# SET enable_seqscan= t; postgres=# SET enable_indexscan = f; postgres=# SET enable_bitmapscan = f; postgres=# select * from test_range_spgist where ir -|- int4range(100,500); ir --- [90,100) [500,510) (2 rows) postgres=# SET enable_seqscan= f; postgres=# select * from test_range_spgist where ir -|- int4range(100,500); ir --- [90,100) [500,510) (2 rows) At this point, both rows are visible via index scan as well as seq scan. postgres=# insert into test_range_spgist select int4range(g, g+10) from generate_series(587,587) g; INSERT 0 1 postgres=# select * from test_range_spgist where ir -|- int4range(100,500); ir -- [90,100) (1 row) Ouch. The second row somehow disappeared. postgres=# SET enable_seqscan= t; postgres=# select * from test_range_spgist where ir -|- int4range(100,500); ir --- [90,100) [500,510) (2 rows) So the last INSERT suddenly makes one row disappear via the index scan though its still reachable via seq scan. I tried looking at the SP-Gist code but clearly I don't understand it a whole lot to figure out the issue, if one exists. Thanks, Pavan -- Pavan Deolasee http://www.linkedin.com/in/pavandeolasee Is there any plug in to examine each page of spgist index? Unfortunately pageinspect only work for btree index.
Re: [HACKERS] Add a filed to PageHeaderData
On Mon, Jun 23, 2014 at 10:23 AM, Soroosh Sardari soroosh.sard...@gmail.com wrote: Dear Hackers I wanted to add a char array with length of 20 to PageHeaderData in include/storage/bufpage.h. Surprisingly regression test failed on rangetypes test! The diff of resulted and expected file is : *** 968,974 select count(*) from test_range_spgist where ir -|- int4range(100,500); count --- ! 5 (1 row) -- now check same queries using a bulk-loaded index --- 968,974 select count(*) from test_range_spgist where ir -|- int4range(100,500); count --- ! 2 (1 row) -- now check same queries using a bulk-loaded index == Any help appreciated. Soroosh Sardari Is there any rule for adding a field to PageHeaderData?
Re: [HACKERS] Add a filed to PageHeaderData
On Tue, Jun 24, 2014 at 1:34 PM, Pavan Deolasee pavan.deola...@gmail.com wrote: On Tue, Jun 24, 2014 at 2:28 PM, Greg Stark st...@mit.edu wrote: On Tue, Jun 24, 2014 at 12:02 AM, Soroosh Sardari soroosh.sard...@gmail.com wrote: Is there any rule for adding a field to PageHeaderData? Not really. It's a pretty internal thing, not something we expect people to be doing all the time. The only rule I can think of is that you should bump some version numbers such as the page format version and probably the catalog version. But that's probably irrelevant to your problem. It sounds like you have a bug in your code but you haven't posted enough information to say much more. Out of curiosity, I actually tried adding a char[20] field in the page header because just like you I thought this should be completely internal, as long as the field is added before the pd_linp[] field. But I get the same failure that OP is reporting. I wonder if its a bug in gist index build, though I could not spot anything at the first glance. FWIW changing the char[] from 20 to 22 or 24 does not cause any failure in rangetypes test. So I am thinking its some alignment issue (mine is a 64 bit build) Thanks, Pavan -- Pavan Deolasee http://www.linkedin.com/in/pavandeolasee I check this problem with a virgin source code of postgresql-9.3.2. So the bug is not for my codes. As Pavan said, may be some alignment issues cause this problem. By the way, following code has two different output and it is weird. drop table if exists test_range_spgist; create table test_range_spgist(ir int4range); create index test_range_spgist_idx on test_range_spgist using spgist (ir); insert into test_range_spgist select int4range(g, g+10) from generate_series(1,590) g; SET enable_seqscan= t; SET enable_indexscan = f; SET enable_bitmapscan = f; select * from test_range_spgist where ir -|- int4range(100,500); SET enable_seqscan= f; SET enable_indexscan = t; SET enable_bitmapscan = f; select * from test_range_spgist where ir -|- int4range(100,500); Regards, Soroosh
Re: [HACKERS] Add a filed to PageHeaderData
On Tue, Jun 24, 2014 at 2:40 PM, Kevin Grittner kgri...@ymail.com wrote: Soroosh Sardari soroosh.sard...@gmail.com wrote: I check this problem with a virgin source code of postgresql-9.3.2. So the bug is not for my codes. By the way, following code has two different output and it is weird. I can confirm that I see the difference in 9.3.2, and that I don't see the difference in 9.3.4. Upgrade. http://www.postgresql.org/support/versioning/ There's really no point in reporting a possible bug on a version with known bugs which have already had fixes published. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company wow, it's arch-dependent. in the 32-bit compiled of PG9.3.2 the code has same output and in 64-bit binary of same code output is different!! The problem is not about the sql code I posted in the last email. Problem could be different in any architecture, In 32-bit or 64-bit architecture adding a char array of length 20 to PageHeaderData cause error in regression test. Regards, Soroosh
Re: [HACKERS] Add a filed to PageHeaderData
On Tue, Jun 24, 2014 at 3:27 PM, Andres Freund and...@2ndquadrant.com wrote: On 2014-06-24 15:23:54 +0430, Soroosh Sardari wrote: On Tue, Jun 24, 2014 at 2:40 PM, Kevin Grittner kgri...@ymail.com wrote: Soroosh Sardari soroosh.sard...@gmail.com wrote: I check this problem with a virgin source code of postgresql-9.3.2. So the bug is not for my codes. By the way, following code has two different output and it is weird. I can confirm that I see the difference in 9.3.2, and that I don't see the difference in 9.3.4. Upgrade. http://www.postgresql.org/support/versioning/ There's really no point in reporting a possible bug on a version with known bugs which have already had fixes published. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company wow, it's arch-dependent. in the 32-bit compiled of PG9.3.2 the code has same output and in 64-bit binary of same code output is different!! The problem is not about the sql code I posted in the last email. Problem could be different in any architecture, In 32-bit or 64-bit architecture adding a char array of length 20 to PageHeaderData cause error in regression test. You likely didn't adapt SizeOfPageHederData. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training Services #define SizeOfPageHeaderData (offsetof(PageHeaderData, pd_linp)) I think ,the macro does not need any change!
[HACKERS] Add a filed to PageHeaderData
Dear Hackers I wanted to add a char array with length of 20 to PageHeaderData in include/storage/bufpage.h. Surprisingly regression test failed on rangetypes test! The diff of resulted and expected file is : *** 968,974 select count(*) from test_range_spgist where ir -|- int4range(100,500); count --- ! 5 (1 row) -- now check same queries using a bulk-loaded index --- 968,974 select count(*) from test_range_spgist where ir -|- int4range(100,500); count --- ! 2 (1 row) -- now check same queries using a bulk-loaded index == Any help appreciated. Soroosh Sardari
[HACKERS] Memory deallocation after calling cast function
Hi I have problem with memory deallocation. look at the following queries 1- create table test01(a) as select generate_series(1,1)::int8 ; 2- create table test02(a) as select generate_series(1,1) ; In execution of first query, memory usage increase rapidly until the transaction comes to end and deallocate all the memory which allocated with palloc. I have wondered why all the memory deallocated at the end, so the cast is removed and query executed again. memory usage was not the same. It was grow very slow. I need help to find the right point to deallocate the memory, Any idea will be appreciated. Soroosh Sardari
[HACKERS] Finding relfilenode
Hi In cost functions such as cost_seqscan, a RelOptinfo indicate a base relation. But there is no relfilenode in the RelOptinfo, So how could i find relfilenode or reloid of the relation? Thanks, Soroosh Sardari
[HACKERS] VACUUM for TOASTed objects
Hi The vacuum procedure do rewrite for a table but, what happened if the table has some TOASTed columns? Please, help me to find a module or function in source code which is responsible for vaccuming the TOAST relation. Regards, Soroosh Sardari
[HACKERS] Crash recovery
Hi When PG crashes or the computer turned down unexpectedly, next time postmaster starts up, it does the crash recovery, actually redo xlog records, vacuum, etc. What module is responsible for crash recovery? Regards, Soroosh Sardari
[HACKERS] RelFileNode to Relation
Hi I need to get a Relation instance but I have only a RelFileNode! I see the relcache.h, only the following function seems helpful extern Relation RelationIdGetRelation(Oid relationId); However, there is another problem, In the RelFileNode, only relNode exist and as comment said this is equivalent to pg_class.relfilenode and in some situation relation oid (pg_class.oid) and relation file node are not the same. So i cant use above function! Any idea? Regards, Soroosh Sardari Sharif University of Tech.
Re: [HACKERS] RelFileNode to Relation
On Sat, Oct 19, 2013 at 11:53 AM, Tom Lane t...@sss.pgh.pa.us wrote: Soroosh Sardari soroosh.sard...@gmail.com writes: I need to get a Relation instance but I have only a RelFileNode! Why do you think you need to do that? Such a lookup is inherently the wrong thing, because relations' relfilenode values are not fixed (unless you have a lock on the relation, which presumably you don't). regards, tom lane I know, it's against PG abstraction. In PG we don't need to know anything about relation in the smgr level. but in my project i want to encrypt all pages of a particular relation and decrypt it when those pages are fetching back to buffer. This behavior depends on some relation properties. So in smgropen I must get some knowledge about the relation and all of i have is RelFileNode. I can not see the pg_class for the relation oid, because smgropen may called before insertion in pg_class. Soroosh
[HACKERS] Planner issue
Hi I developed a new character string type, named myvarchar. Also an operator class for btree is added. I created a table with two columns, first have myvarchar(100) and other is varchar(100). CREATE TABLE test_myvarchar (mine myvarchar(100), plain varchar(100)); CREATE INDEX test_myvarchar_i_mine ON test_myvarchar USING btree (mine); CREATE INDEX test_myvarchar_i_plain ON test_myvarchar USING btree (plain); Two same random strings to both of columns are inserted, and the operation repeated until 32K rows are in the table. INSERT INTO test_myvarchar VALUES ('example', 'example'); PROBLEM: When I executed a query with where clause on 'mine' column, PG does not use index. But after I changed where clause to be on 'plain' column, PG uses index! EXPLAIN SELECT * FROM test_myvarchar WHERE 'zagftha' = mine ORDER BY 1; -- Sort (cost=3038.39..3065.00 rows=10642 width=197) Sort Key: mine - Seq Scan on test_myvarchar (cost=0.00..1308.08 rows=10642 width=197) Filter: ('zagftha'::myvarchar = mine) ## EXPLAIN SELECT * FROM test_myvarchar WHERE 'zagftha' = plain ORDER BY 2; Index Scan using test_myvarchar_i_plain on test_myvarchar (cost=0.41..6099.0 8 rows=31175 width=197) Index Cond: ('zagftha'::text = (plain)::text) Why planner does not choose the lowest cost path? Is there any problem with my new type? How can I fix it? Any help would be appreciated. Regards, Soroosh Sardari Sharif University of Technology
Fwd: [HACKERS] Planner issue
2013/10/14 Soroosh Sardari soroosh.sard...@gmail.com Hi I developed a new character string type, named myvarchar. Also an operator class for btree is added. I created a table with two columns, first have myvarchar(100) and other is varchar(100). CREATE TABLE test_myvarchar (mine myvarchar(100), plain varchar(100)); CREATE INDEX test_myvarchar_i_mine ON test_myvarchar USING btree (mine); CREATE INDEX test_myvarchar_i_plain ON test_myvarchar USING btree (plain); Two same random strings to both of columns are inserted, and the operation repeated until 32K rows are in the table. INSERT INTO test_myvarchar VALUES ('example', 'example'); PROBLEM: When I executed a query with where clause on 'mine' column, PG does not use index. But after I changed where clause to be on 'plain' column, PG uses index! EXPLAIN SELECT * FROM test_myvarchar WHERE 'zagftha' = mine ORDER BY 1; -- Sort (cost=3038.39..3065.00 rows=10642 width=197) Sort Key: mine - Seq Scan on test_myvarchar (cost=0.00..1308.08 rows=10642 width=197) Filter: ('zagftha'::myvarchar = mine) ## EXPLAIN SELECT * FROM test_myvarchar WHERE 'zagftha' = plain ORDER BY 2; Index Scan using test_myvarchar_i_plain on test_myvarchar (cost=0.41..6099.0 8 rows=31175 width=197) Index Cond: ('zagftha'::text = (plain)::text) Why planner does not choose the lowest cost path? Is there any problem with my new type? How can I fix it? Any help would be appreciated. Regards, Soroosh Sardari Sharif University of Technology On Mon, Oct 14, 2013 at 10:29 AM, Pavel Stehule pavel.steh...@gmail.com wrote: Hello pls, send a output of EXPLAIN ANALYZE statement, there can be different reasons why optimizer doesn't choose some index Regards Pavel Stehule The output of EXPLAIN ANALYSE for the two queries come in the blow. Sort (cost=3038.39..3065.00 rows=10642 width=197) (actual time=938.564..1168.1 18 rows=31070 loops=1) Sort Key: mine Sort Method: external merge Disk: 6304kB - Seq Scan on test_myvarchar (cost=0.00..1308.08 rows=10642 width=197) (a ctual time=0.072..78.545 rows=31070 loops=1) Filter: ('zagftha'::myvarchar = mine) Rows Removed by Filter: 856 Total runtime: 1176.822 ms Index Scan using test_myvarchar_i_plain on test_myvarchar (cost=0.41..6099.0 8 rows=31175 width=197) (actual time=0.124..61.417 rows=31054 loops=1) Index Cond: ('zagftha'::text = (plain)::text) Total runtime: 67.918 ms
Re: [HACKERS] Planner issue
On Mon, Oct 14, 2013 at 10:55 AM, Tom Lane t...@sss.pgh.pa.us wrote: Soroosh Sardari soroosh.sard...@gmail.com writes: I developed a new character string type, named myvarchar. Also an operator class for btree is added. PROBLEM: When I executed a query with where clause on 'mine' column, PG does not use index. Most likely you got the opclass definition wrong. Since you've shown us no details of what you did, it's hard to speculate about just how. But note that varchar itself is a pretty bad model for a user-added datatype, because it has a special symbiotic relationship with type text (to wit, it has no operators of its own but uses text's operators via implicit casts). To get to a working independent datatype like this, you'd need to pick the right aspects of each of text and varchar to clone. So my unfounded speculation is you didn't do that just right. regards, tom lane As Tom said, I did something wrong when I was creating new operators. The RESTRICT parameter is forgotten. Since all varchar operations redirected to text operators, hence my operators must be like operators of type text. I used following command to find text operator: select * from pg_operator where oprleft = 25 and oprright = 25 P.S : 25 is oid of text type. Cheers, Soroosh Sardari
[HACKERS] Pattern matching operators a index
Hi I'm developing a new type for character string, like varchar. I wrote operators for btree and so forth. I wonder how pattern matching operators using btree index, because btree operator class ony knows about , =, =, and = operators, but operators for pattern matching, such as LIKE, are not known for btree access method. Now my question is: Is Postgre using btree for pattern matching query for varchar or other character string types? If it does, how i implement it for my new type? Regards, Soroosh
[HACKERS] Pattern matching operators a index
Hi I'm developing a new type for character string, like varchar. I wrote operators for btree and so forth. I wonder how pattern matching operators using btree index, because btree operator class ony knows about , =, =, and = operators, but operators for pattern matching, such as LIKE, are not known for btree access method. Now my question is: Is Postgre using btree for pattern matching query for varchar or other character string types? If it does, how i implement it for my new type? Regards, Soroosh
[HACKERS] A general Q about index
Hi I want to know how an index is created and used. actually if you can show to me a simple start point, it would be great. Regards, Soroosh Sardari
Re: [HACKERS] A general Q about index
On Tue, Jul 16, 2013 at 7:00 PM, David Johnston pol...@yahoo.com wrote: David Johnston wrote soroosh sardari wrote Hi I want to know how an index is created and used. actually if you can show to me a simple start point, it would be great. Regards, Soroosh Sardari In the documentation there is a table of contents and listed on that table is a section named Indexes. David J. Since you posted this to hacker you may mean you wish to know how to program them as oppose to use them in SQL. I have no clue to this regard. If you did mean use in SQL then the documentation is your friend and you also should not have posted this question to -hackers but to -general instead; probably should have posted there anyway to begin with and been more clear as to what you mean by created and used. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/A-general-Q-about-index-tp5763912p5763928.html Sent from the PostgreSQL - hackers mailing list archive at Nabble.com. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers Actually I mean the index in the source code, I want to know how index is used in the backend for execution of some query. sorry my question is a bit ambiguous, I start to read src/backend/access/index/genam.c, and I think maybe this file is not good way to start. let me write a bunch of question to illustrate my point, -How create an index for a table with specified field -How index is stored in a page -what module is responsible to fetch and swap out index pages -Is there a kind of abstract class for all variant of index?
Re: [HACKERS] A general Q about index
On Tue, Jul 16, 2013 at 7:00 PM, David Johnston pol...@yahoo.com wrote: David Johnston wrote soroosh sardari wrote Hi I want to know how an index is created and used. actually if you can show to me a simple start point, it would be great. Regards, Soroosh Sardari In the documentation there is a table of contents and listed on that table is a section named Indexes. David J. Since you posted this to hacker you may mean you wish to know how to program them as oppose to use them in SQL. I have no clue to this regard. If you did mean use in SQL then the documentation is your friend and you also should not have posted this question to -hackers but to -general instead; probably should have posted there anyway to begin with and been more clear as to what you mean by created and used. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/A-general-Q-about-index-tp5763912p5763928.html Sent from the PostgreSQL - hackers mailing list archive at Nabble.com. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers Actually I mean the index in the source code, I want to know how index is used in the backend for execution of some query. sorry my question is a bit ambiguous, I start to read src/backend/access/index/genam.c, and I think maybe this file is not good way to start. let me write a bunch of question to illustrate my point, -How create an index for a table with specified field -How index is stored in a page -what module is responsible to fetch and swap out index pages -Is there a kind of abstract class for all variant of index?
[HACKERS] pgsql_tmp and external sort
Dear Hackers Recently I find about pgsql_tmp directory. As I think, this directory is a area for making temporal files which are used for external sort. I wonder if anyone could help me to find the module of pg that is responsible for the temporal space and external sort in the PG source code. Regards Soroosh Sardari
[HACKERS] SLRU
Hey I was reading the multi transaction log manager, multixact.c. I didn't get what SLRU does. I want the goal of this module, and why we use it. I'm kind of newbie, be patient with me ;) Regards Soroosh
Re: [HACKERS] Which table stored in which file in PGDATA/base/[db-oid]
On Sat, Jun 1, 2013 at 3:57 PM, Andres Freund and...@2ndquadrant.comwrote: On 2013-06-01 13:04:55 +0200, Martijn van Oosterhout wrote: On Sat, Jun 01, 2013 at 03:27:40PM +0430, Soroosh Sardari wrote: Yes, I have some files which is not in pg_class.relfilenode of any table or index. I want to know which table or index stored in such files. That shouldn't happen. Are you sure you're looking in the right database? Kan you list the filenames? It's actually entirely normal. For some system tables the actual relfilenode isn't stored in the system catalog but in the relation mapper. Those are a) tables needed to access the catalogs themselves like pg_class, pg_attribute, pg_proc, .. b) shared tables where we otherwise couldn't change the relfilenode from another database To get the actual relfilenode you actually need to do something like: SELECT relname, pg_relation_filenode(pg_class.oid) FROM pg_class; Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training Services Dear Andres You are right, Some tables are mapped, and some other are global. The SQL query is really helpful. Thanks, Soroosh
[HACKERS] Which table stored in which file in PGDATA/base/[db-oid]
Dear Hackers I've created a new DB, and a bunch of files created in base/12054, 12054 is oid of the new DB. I want to find what table stored in each file. BTW, I read this http://www.postgresql.org/docs/9.2/interactive/storage-file-layout.html I have 156 files with numerical names, vm and fsm file are ignored. 107 files are same as pg_class.reltoastrelid,so I have 49 files that I do not know what tables stored in them. Any idea to find ? Thanks, Soroosh
Re: [HACKERS] Which table stored in which file in PGDATA/base/[db-oid]
Yes, I have some files which is not in pg_class.relfilenode of any table or index. I want to know which table or index stored in such files. From that page: Each table and index is stored in a separate file. For ordinary relations, these files are named after the table or index's filenode number, which can be found in pg_class.relfilenode. Have a nice day, -- Martijn van Oosterhout klep...@svana.org http://svana.org/kleptog/ He who writes carelessly confesses thereby at the very outset that he does not attach much importance to his own thoughts. -- Arthur Schopenhauer -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) iQIVAwUBUanSAkvt++dL5i1EAQhn6hAAg9eiZEz2eV6Z/5f8ae56MNGwM5L1P6nU y2pN49PoSz0FkO3lBwcShH3/O0s+SgNy8kh6Klm1qDlwvX9HFGeRVd9guX7/fFil eu+Ueg5nVzXA4fb/NwjS+Hh1B+/NdJQnklddP6K4Pm0VW51wqaaFA3hn/CfNMiO2 07i8L/NFjlngc5wstQLGcxuE5bl69c1qGhl8RHoOPLRhFgMSzkxSR9TglTDPaniu rptpWvHgfRYdorANBaSI3SByw8WeSPbrTHusX4XC5zVkIk7GZQiogQlQVRA7yBT6 YpdjqB4thWDctR4VLv0yvBRJ5g7M9GkhWSOmpDoRBWCB2EFFPwrBhyrxt/e/aPCn +Nt1nFxtKGV4/tPW7cI9b4bv2OZctmOaoDByqAZUuB891eOebVjif9MsQeG5IWFb 5KOnQcQ+TxlmCkF7zot5Tv8ndMTtJN8eKAkhay+xmLjON/2tGl+ArKbVAqck2oIb xGSavSLg6HZ/FmMNkbHVSo6/Z7Nmup2GGYsWWJhHvoO0hbGHCnxobAsWQGPUsC7l 6osFCcBokvZtIERLttznP1S8RvmLP6EuByxNNQY4MV1GJm55P1PHZeWRGCYMEDil Fs73My0YxHBtnjI/LbgJ4GhKzINsQqviHJPFraKq8NdW/+B3Pte6bmtlRFa8Z/t+ J6hjI9Wgky0= =68cp -END PGP SIGNATURE-
Re: [HACKERS] Which table stored in which file in PGDATA/base/[db-oid]
Yes, I'm sure. Difference of filenodes and new files changed w.r.t my first mail, because I added a table. I attached 3 files, newfile.pg : list of numerical files in base/[db-oid], ls | grep '[[:digit:]]\' filenode.pg : select distinct relfilenode from pg_class newfile-filenode.pg : Set of oids which exists in newfile.pg and does not in filenode.pg On Sat, Jun 1, 2013 at 3:34 PM, Martijn van Oosterhout klep...@svana.orgwrote: On Sat, Jun 01, 2013 at 03:27:40PM +0430, Soroosh Sardari wrote: Yes, I have some files which is not in pg_class.relfilenode of any table or index. I want to know which table or index stored in such files. That shouldn't happen. Are you sure you're looking in the right database? Kan you list the filenames? Have a nice day, newfile.pg Description: Binary data filenode.pg Description: Binary data newfile-filenode.pg Description: Binary data -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] Why there is a union in HeapTupleHeaderData struct
Dear Hackers In fix part oh HeapTuple, there is a union that is named t_choice, union { HeapTupleFields t_heap; DatumTupleFields t_datum; }t_choice; I can't find out why we need t_datum, actually there is no comment about DatumTupleFields. Regards Soroosh
Re: [HACKERS] Why there is a union in HeapTupleHeaderData struct
Thanks, If a tuple constructed in memory we don't need t_heap. I have another question, How make an in-memory tuple? On Mon, May 20, 2013 at 12:46 PM, Amit Langote amitlangot...@gmail.comwrote: Hello, I think the comment just above the HeapTupleFields struct definition has the related details. /* * Heap tuple header. To avoid wasting space, the fields should be * laid out in such a way as to avoid structure padding. * * Datums of composite types (row types) share the same general structure * as on-disk tuples, so that the same routines can be used to build and * examine them. However the requirements are slightly different: a Datum * does not need any transaction visibility information, and it does need * a length word and some embedded type information. We can achieve this * by overlaying the xmin/cmin/xmax/cmax/xvac fields of a heap tuple * with the fields needed in the Datum case. Typically, all tuples built * in-memory will be initialized with the Datum fields; but when a tuple is * about to be inserted in a table, the transaction fields will be filled, * overwriting the datum fields. especially the last line points as to what roles each of them plays, though, I would like to hear more about additional details from others who might reply. On Mon, May 20, 2013 at 4:28 PM, Soroosh Sardari soroosh.sard...@gmail.com wrote: Dear Hackers In fix part oh HeapTuple, there is a union that is named t_choice, union { HeapTupleFields t_heap; DatumTupleFields t_datum; }t_choice; I can't find out why we need t_datum, actually there is no comment about DatumTupleFields. Regards Soroosh -- Amit Langote
Re: [HACKERS] Road map to study about fetching a set of tuples - novice!
Thanks, it's helpful. The flowchart is a very good point to start. Cheers, Soroosh On Sat, May 18, 2013 at 7:56 PM, Atri Sharma atri.j...@gmail.com wrote: Sent from my iPad On 18-May-2013, at 20:49, Dickson S. Guedes lis...@guedesoft.net wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Em 18-05-2013 11:40, Atri Sharma escreveu: On 18-May-2013, at 20:01, Soroosh Sardari soroosh.sard...@gmail.com wrote: Hi I was tracing a simple SELECT query to find how pg works for fetching tuples. but I'm totally lost in the code. Could you help me to understand under the hood? I know about parsing and planning parts, my actual problem is executer. If you show me a road map to study, I would appreciate it. You can probably try: http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/executor/README;h=8afa1e3e4a7596475cbf19a76c88d48a04aeef02;hb=HEAD There is a cool flowchart too: http://www.postgresql.org/developer/backend/ Oh yes, I am in love with that flow chart.It is so easy and expressive! Regards, Atri
[HACKERS] Road map to study about fetching a set of tuples - novice!
Hi I was tracing a simple SELECT query to find how pg works for fetching tuples. but I'm totally lost in the code. Could you help me to understand under the hood? I know about parsing and planning parts, my actual problem is executer. If you show me a road map to study, I would appreciate it. Regards Soroosh
Re: [HACKERS] Meaning of keyword category list in src/backend/parser/gram.y
Dear Amit yes, my new constrains must not be name of variable. I moved new keyword to reserved keyword. Problem solved :D Regards Soroosh On Mon, May 6, 2013 at 10:17 AM, Amit Kapila amit.kap...@huawei.com wrote: On Sunday, May 05, 2013 1:03 PM soroosh sardari wrote: Hi I'm trying to add a new constraint to column constraint. I add a new keyword ro kwlist.h and gram.y, and also edit ColConstraintElem. The problem is i don't know what is Keyword category lists at the end of gram.y. Keyword category lists are to distinguish different type of keywords. For example, if you add keyword in reserved_keyword, then you cannot use that as variable in SQL where as if you put in unreserved_keyword, then you can use it. when I added the new keyword in unreserved_keyword, shift/reduce and reduce/reduce conflicts appear in bison outputs. any idea about this problem and meaning of Keyword category lists is appreciated. This means the grammar syntax you have defined for ColConstraintElem conflicts with some already existing definition. shift/reduce conflicts can occur due to your changes in ColConstraintElem definition. I suggest first you can try with minimal/dummy changes in ColConstraintElem and once it passes then you can try with your actual changes to see what part of changes cause conflicts. With Regards, Amit Kapila. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] Meaning of keyword category list in src/backend/parser/gram.y
Hi I'm trying to add a new constraint to column constraint. I add a new keyword ro kwlist.h and gram.y, and also edit ColConstraintElem. The problem is i don't know what is Keyword category lists at the end of gram.y. when I added the new keyword in unreserved_keyword, shift/reduce and reduce/reduce conflicts appear in bison outputs. any idea about this problem and meaning of Keyword category lists is appreciated. Cheers Soroosh