[SQL] How to find out if an index is unique?

2002-07-17 Thread Dirk Lutzebaeck
Hello, is there a way to ask the system tables if a given index was created with the unique qualification? I don't want to insert data to try. Greetings, Dirk ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.

[SQL] How to get total number of rows when using LIMIT/OFFSET?

2002-07-10 Thread Dirk Lutzebaeck
Hello, when using LIMIT/OFFSET is it possible to get also the total number of rows besides the actual number of rows of the select? It should be there because the whole list is ordered anyhow. I'm using 7.2.1. Thanks for help, Dirk ---(end of broadcast)--

[SQL] Can somebody help me to optimize this huge query?

2002-06-21 Thread Dirk Lutzebaeck
Hi, here is a query on two tables whith lots of self joins which just takes hours to complete on 7.2.1. I use multi dimensional indices which are shown in the explain comments. My question is how can I use explicit join syntax to let the planner do better. I think Geoq does not match yet because

[SQL] Optimizer question with equivalent joins

2002-06-21 Thread Dirk Lutzebaeck
Hello, say I have a join which says t.a = t.b and t.b = t.c do I need to give the optimizer a hint by saying it more redundantly t.a = t.b and t.b = t.c and t.c = t.a or is this just counter productive because there is one more join? In the real world I have 10-20 equivalent joins w

Re: [SQL] counting distinct rows on more than one column

2001-03-28 Thread Dirk Lutzebaeck
Michael Fork writes: > In 7.0.3, I believe the following would work: > > SELECT count(distinct(a || b)) FROM t; Great, this works! I don't quite get it why... Dirk ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send

[SQL] counting distinct rows on more than one column

2001-03-28 Thread Dirk Lutzebaeck
Hi, on 7.0.3 want to COUNT SELECT DISTINCT a,b FROM t; I can't find a solution because any combination with count with more than one column gives syntax errors. One solution would be to set a view: CREATE VIEW v AS SELECT DISTINCT a,b FROM t; and then SELECT count(a) FROM v but views do