Re: [SQL] time interval math
On 2012-02-09, Edward W. Rouse wrote: >> the operation abs() is meaninless on the type interval >> eg: what is abs( '1 month - 32 days + 24 hours'::interval ) > > If you need to add 30 intervals together, then +- is not meaningless. if you stop reading after one line you miss the answer. -- ⚂⚃ 100% natural -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] foreign key is it a real key
Hi, I have read a few articles and I'm not sure if it's me or the authors but I do not believe my question was answered. If I have table that has a PK and a FK - will the planner use the FK just same as it would use the PK? IOW's is a FK also an index used by the planner? I have a lagacy table that contains a FK constraint (vendor_id --> vendor_info). I believe I need an index to improve the performance of a query because I'm using the column as part of my join. Explain does not appear to use it as an index (instead of a seq scan it uses a hash join). But the table all ready has a FK key contraint on the column. Thanks in advance, Johnf -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] foreign key is it a real key
John Fabiani wrote: > Hi, > I have read a few articles and I'm not sure if it's me or the authors but I > do > not believe my question was answered. > > If I have table that has a PK and a FK - will the planner use the FK just > same > as it would use the PK? IOW's is a FK also an index used by the planner? > > I have a lagacy table that contains a FK constraint (vendor_id --> > vendor_info). I believe I need an index to improve the performance of a > query > because I'm using the column as part of my join. Explain does not appear to > use it as an index (instead of a seq scan it uses a hash join). But the > table > all ready has a FK key contraint on the column. Yes, for large tables you have to create a own index on your fk-column. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889° -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] foreign key is it a real key
On Monday, February 13, 2012 04:50:47 PM Andreas Kretschmer wrote: > John Fabiani wrote: > > Hi, > > I have read a few articles and I'm not sure if it's me or the authors > > but I do not believe my question was answered. > > > > If I have table that has a PK and a FK - will the planner use the FK > > just same as it would use the PK? IOW's is a FK also an index used by > > the planner? > > > > I have a lagacy table that contains a FK constraint (vendor_id --> > > vendor_info). I believe I need an index to improve the performance of a > > query because I'm using the column as part of my join. Explain does > > not appear to use it as an index (instead of a seq scan it uses a hash > > join). But the table all ready has a FK key contraint on the column. > > Yes, for large tables you have to create a own index on your fk-column. > > > Andreas Thanks Johnf -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
