Re: [GENERAL] Indices and Foreign Tables

2014-04-04 Thread Torsten Förtsch
On 04/04/14 17:14, Kohler Manuel (ID SIS) wrote: > Here is the same query with fdw: > > db=# EXPLAIN VERBOSE select ds.code, count(*), sum(dsf.size_in_bytes) as > "raw_size",pg_size_pretty(sum(dsf.size_in_bytes)) as "size" from > data_set_files_fdw dsf, data_sets_fdw ds where dsf.parent_id is nu

Re: [GENERAL] Indices and Foreign Tables

2014-04-04 Thread Tom Lane
"Kohler Manuel (ID SIS)" writes: > here are the Query plans. The first plan is on the source database directly. > So no fdw involved: Do you have use_remote_estimate enabled? The rowcount estimates for the foreign tables seem pretty far from reality; use_remote_estimates should help.

Re: [GENERAL] Indices and Foreign Tables

2014-04-04 Thread Kohler Manuel (ID SIS)
Hi, here are the Query plans. The first plan is on the source database directly. So no fdw involved: source_db=# EXPLAIN ANALYZE select ds.code, count(*), sum(dsf.size_in_bytes) as "raw_size",pg_size_pretty(sum(dsf.size_in_bytes)) as "size" from data_set_files dsf, data_sets ds where dsf.parent

Re: [GENERAL] Indices and Foreign Tables

2014-04-04 Thread Albe Laurenz
Kohler Manuel wrote: > I have a question regarding the use of indices when querying foreign data > tables (using postgres_fdw > of 9.3 to another postgres DB). > Everything works fine beside the fact that the indices which are defined in > the foreign DB are not > used at all when I do query it t

[GENERAL] Indices and Foreign Tables

2014-04-04 Thread Kohler Manuel (ID SIS)
Hi, I have a question regarding the use of indices when querying foreign data tables (using postgres_fdw of 9.3 to another postgres DB). Everything works fine beside the fact that the indices which are defined in the foreign DB are not used at all when I do query it through the foreign data wrap

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-02-01 Thread Mohamed
Yeah, but reply-all will still send private messages :O .. its strange because this is the only mailing list that gmail behaves like this with.. it must have to with how postgre sends messages out. But anyways. Back to topic :) Yeah, I think that a partial index is something that would be smart. T

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-02-01 Thread Gregory Stark
Mohamed writes: > My Gmail(bloody gmail!) has been auto-replying to the last messager (Scott) > so I think we have been having a private discussion on this topic. There is an option in the Google Labs tab to make "Reply All" the default button -- of course then there's always a chance you'll ma

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-02-01 Thread Martijn van Oosterhout
On Sun, Feb 01, 2009 at 06:00:02PM +0100, Mohamed wrote: > When it comes to the boolean, the content is about 70-30%. I find it strange > though that an index on a 50-50% isn't that useful. With an index the DB can > skip 50% of the table so it should be useful, but perhaps the intersection > of se

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-02-01 Thread Mohamed
My Gmail(bloody gmail!) has been auto-replying to the last messager (Scott) so I think we have been having a private discussion on this topic. Here is an update on our discussion. ME : When it comes to the boolean, the content is about 70-30%. I find it strange though that an index on a 50-50% isn

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-01-31 Thread Scott Marlowe
On Sat, Jan 31, 2009 at 1:33 PM, Gregory Stark wrote: > No index is going to be particularly effective for boolean columns unless > they're very heavily skewed. You might find it useful to build separate > partial indexes on other keys for each value though. Not entirely true. If you've got a ta

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-01-31 Thread Kevin Murphy
Gregory Stark wrote: Mohamed writes: I want to match against a boolean field, that is, only true or false is possible. I am thinking Btree but not sure.. correct? No index is going to be particularly effective for boolean columns unless they're very heavily skewed. You might find it

Re: [GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-01-31 Thread Gregory Stark
Mohamed writes: > Hi, > I have several fields that use to match with my queries. I am curious to > what index types is best for what. Here is some examples that will help you > understand. > > Say I have a 1000 000 rows. > > Speed is of the essence here, insertions and updates happens relatively

[GENERAL] Indices types, what to use. Btree, Hash, Gin or Gist

2009-01-31 Thread Mohamed
Hi, I have several fields that use to match with my queries. I am curious to what index types is best for what. Here is some examples that will help you understand. Say I have a 1000 000 rows. Speed is of the essence here, insertions and updates happens relatively less frequent than search. I wa

Re: [GENERAL] Indices for select count(*)?

2005-12-23 Thread Tom Lane
Bruce Momjian writes: >> On Fri, Dec 23, 2005 at 11:04:50AM -0500, Tom Lane wrote: >>> It's not that easy --- in the MVCC world there simply isn't a unique >>> count that is the right answer for every observer. But the idea of >>> packaging a count(*) mechanism as an index type seems like it migh

Re: [GENERAL] Indices for select count(*)?

2005-12-23 Thread Bruce Momjian
Martijn van Oosterhout wrote: -- Start of PGP signed section. > On Fri, Dec 23, 2005 at 11:04:50AM -0500, Tom Lane wrote: > > It's not that easy --- in the MVCC world there simply isn't a unique > > count that is the right answer for every observer. But the idea of > > packaging a count(*) mechani

Re: [GENERAL] Indices for select count(*)?

2005-12-23 Thread Tom Lane
Martijn van Oosterhout writes: > AFAICS two big problems with using an index type: > 1. The index isn't told when the tuple is deleted. Hm, good point ... we could make it do so but for ordinary deletes it'd be a waste of cycles to open indexes at all. > 2. The server expects to be able to look

Re: [GENERAL] Indices for select count(*)?

2005-12-23 Thread Martijn van Oosterhout
On Fri, Dec 23, 2005 at 11:04:50AM -0500, Tom Lane wrote: > It's not that easy --- in the MVCC world there simply isn't a unique > count that is the right answer for every observer. But the idea of > packaging a count(*) mechanism as an index type seems like it might be > a good one. I don't thin

Re: [GENERAL] Indices for select count(*)?

2005-12-23 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > One way to conceptually tackle this count(*) issue would be to create a new > index type for it. The index type would (logically) just need to implement > insert and delete operations and keep a running count with a big lock around > it. Users cou

Re: [GENERAL] Indices for select count(*)?

2005-12-23 Thread Peter Eisentraut
One way to conceptually tackle this count(*) issue would be to create a new index type for it. The index type would (logically) just need to implement insert and delete operations and keep a running count with a big lock around it. Users could then choose to trade off concurrent performance ag

Re: [GENERAL] Indices for select count(*)?

2005-12-22 Thread Jaime Casanova
> > I wouldn't mind a "with visibility" switch for indexes that you could > throw when creating them for this purpose. But burdening all indexes > with this overhead when most wouldn't need it is not, IMHO, a good idea. > that would add complexity to the index code for... just one case? what abo

Re: [GENERAL] Indices for select count(*)?

2005-12-22 Thread Scott Marlowe
On Thu, 2005-12-22 at 09:33, Jim C. Nasby wrote: > On Thu, Dec 22, 2005 at 04:10:50PM +0100, Martijn van Oosterhout wrote: > > Actually, ISTM the trend is going the other way. MySQL has instant > > select count(*), as long as you're only using ISAM. Recent versions of > > No comment. > > > MSSQL

Re: [GENERAL] Indices for select count(*)?

2005-12-22 Thread Greg Stark
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > I didn't think the method of adding the imperfect known_visible bit to > the indexes had that much overhead, but it's been a while since those > discussions took place. I do recall some issue being raised that will be > very difficult to solve (though

Re: [GENERAL] Indices for select count(*)?

2005-12-22 Thread Jim C. Nasby
On Thu, Dec 22, 2005 at 04:10:50PM +0100, Martijn van Oosterhout wrote: > Actually, ISTM the trend is going the other way. MySQL has instant > select count(*), as long as you're only using ISAM. Recent versions of No comment. > MSSQL use an MVCC type system and it also scans the whole table. Orac

Re: [GENERAL] Indices for select count(*)?

2005-12-22 Thread Martijn van Oosterhout
On Thu, Dec 22, 2005 at 08:52:08AM -0600, Jim C. Nasby wrote: > Back when I was using other databases more often, it wasn't uncommon to > see a 10x speed improvement on count(*) from using an index. This is an > area where PostgreSQL is seriously behind other databases. Of course > having vastly su

Re: [GENERAL] Indices for select count(*)?

2005-12-22 Thread Jim C. Nasby
On Wed, Dec 21, 2005 at 04:54:08PM -0500, Greg Stark wrote: > MSSQL presumably has the entire table cached in RAM and postgres doesn't. Even > if MSSQL can scan just the index (which postgres can't do) I would only expect > a factor of 2-4x. Hm. Unless perhaps this table is extremely wide? How larg

Re: [GENERAL] Indices for select count(*)?

2005-12-21 Thread Chris Browne
[EMAIL PROTECTED] (Marcus Engene) writes: > Greg Stark wrote: >> Alexander Scholz <[EMAIL PROTECTED]> writes: >> >>>Hi, thank you for your answer. >>> >>>Regarding the performance flow when trying to find out how many records are >>>currently being stored in the table, I don't see how an index shou

Re: [GENERAL] Indices for select count(*)?

2005-12-21 Thread Jaime Casanova
On 12/21/05, Marcus Engene <[EMAIL PROTECTED]> wrote: > Greg Stark wrote: > > Alexander Scholz <[EMAIL PROTECTED]> writes: > > > >>Hi, thank you for your answer. > >> > >>Regarding the performance flow when trying to find out how many records are > >>currently being stored in the table, I don't see

Re: [GENERAL] Indices for select count(*)?

2005-12-21 Thread Marcus Engene
Greg Stark wrote: Alexander Scholz <[EMAIL PROTECTED]> writes: Hi, thank you for your answer. Regarding the performance flow when trying to find out how many records are currently being stored in the table, I don't see how an index should help... Nevertheless we've created an unique index on "

Re: [GENERAL] Indices for select count(*)?

2005-12-21 Thread Nicolas Barbier
On 12/21/05, Alexander Scholz <[EMAIL PROTECTED]> wrote: > Regarding the performance flow when trying to find out how many records > are currently being stored in the table, I don't see how an index should > help... Nevertheless we've created an unique index on "ID" but SELECT > count("ID") from "

Re: [GENERAL] Indices for select count(*)?

2005-12-21 Thread Greg Stark
Alexander Scholz <[EMAIL PROTECTED]> writes: > Hi, thank you for your answer. > > Regarding the performance flow when trying to find out how many records are > currently being stored in the table, I don't see how an index should help... > Nevertheless we've created an unique index on "ID" but SE

Re: [GENERAL] Indices for select count(*)?

2005-12-21 Thread Peter Eisentraut
Am Mittwoch, 21. Dezember 2005 12:01 schrieb Alexander Scholz: > So - what kind of indexing would speed this up then? You can't speed up a full-table count using an index. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ?

[GENERAL] Indices for select count(*)?

2005-12-21 Thread Alexander Scholz
Hi, thank you for your answer. Regarding the performance flow when trying to find out how many records are currently being stored in the table, I don't see how an index should help... Nevertheless we've created an unique index on "ID" but SELECT count("ID") from "XYZ" still takes 35 seconds*.

Re: [GENERAL] indices and cidr/inet type

2003-08-14 Thread Richard Welty
On Tue, 05 Aug 2003 18:46:47 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: > Richard Welty <[EMAIL PROTECTED]> writes: > > hmmm. where should i go looking for sample code implementing operator > > classes as an example? > > contrib. Specifically, I'd suggest looking at contrib/seg, which > defines a

Re: [GENERAL] indices and cidr/inet type

2003-08-14 Thread Tom Lane
Richard Welty <[EMAIL PROTECTED]> writes: > what type of index is recommended when the dominant lookup on a field is > '' << ipblock I don't think we have a suitable index type at the moment; or more accurately, we don't have a suitable operator class. It would be an interesting exercise to write

Re: [GENERAL] indices and cidr/inet type

2003-08-14 Thread Richard Welty
On Tue, 05 Aug 2003 15:09:00 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: > Richard Welty <[EMAIL PROTECTED]> writes: > > what type of index is recommended when the dominant lookup on a field > is > > '' << ipblock > > I don't think we have a suitable index type at the moment; or more > accurately,

[GENERAL] indices and cidr/inet type

2003-08-05 Thread Richard Welty
in looking over the section of the users manual on indices, i see that R-Tree indices are recommended for <<, but this advice is clearly tied to the geometric interpretation of << ("to the left of") rather than the network interpretation ("is contained in"). what type of index is recommended when

[GENERAL] indices are crashed after installation of rpm

2001-04-26 Thread Peter Keller
hello all, we are running PostgreSQL 7.0.2 on Solaris 2.6,/x86 compiled by gcc 2.8.1. For installation Postgres on 70 Solaris-2.6 server we built packages (SVR4-style). The first time we installed Postgres everything was ok. But after a new installation of the package ( - same Postgres version

[GENERAL] indices are crashed after installation of rpm

2001-04-24 Thread Peter Keller
hello all, we are running PostgreSQL 7.0.2 on Solaris 2.6,/x86 compiled by gcc 2.8.1. For installation Postgres on 70 Solaris-2.6 server we built packages (SVR4-style). The first time we installed Postgres everything was ok. But after a new installation of the package ( - same Postgres version!

[GENERAL] indices

2000-11-29 Thread Sandeep Joshi
Hi, I had learned in theory that Hash indices are used for "=" and B-tree for "<" ,">". explain command doesn't tell us which index it is using. Hash or Btree? Also, should a following query "id < 1243" invoke a index ? (assuming there is an index on id). I have seen Postgres

[GENERAL] indices on tab1.a=tab2.a

2000-01-12 Thread admin
I have unfortunately deleted a message to pgsql-general today which contained a query like: SELECT tab1.b, tab2.c FROM tab1, tab2 WHERE tab1.a=tab2.a; There was also a UNION following, but my memory fails me. My question is though, can an index be used for the above query? When I try it with an

[GENERAL] indices don't make much difference

1999-12-15 Thread admin
I am trying to optimise a query which looks like: select prod_base.*, manu_base.name from prod_base, manu_base where prod_base.mid=manu_base.mid; manu_base is a table consisting of 3000 manufacturer with an id (not unique to support synonyms) and a name (declared as varchar(32)). prod_base is a t