[GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread DaNieL
Hi guys, im tryin to optimize a simple table, suited for contain users. So, my table at the moment is: - CREATE TABLE contacts( id BIGSERIAL PRIMARY KEY NOT NULL UNIQUE, company_id BIGINT, code varchar(10), company_name varchar(120), name varchar(120), surname varchar(120), phone

Re: [GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread DaNieL..!
Almost forgot: one fo the heavier select query can be: - SELECT contact.id, contact.company_id, contact.name AS nome, contact.surname AS cognome, contact.email AS email, contact.company_name AS azienda FROM contact WHERE ( lower(contact.company_name) LIKE

Re: [GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread Grzegorz Jaśkiewicz
it looks ok on explain, that is - the cost isn't too high. So what's the problem ? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread DaNieL..!
The `problem` is that i dont know if having so many indexes will raise problems as the data dimension grown. And i am not even sure that this design is truly reliable; For example, if i would to know how many employees have every company, i'll have to run that query: - EXPLAIN ANALYZE SELECT

Re: [GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread Grzegorz Jaśkiewicz
2009/6/23 DaNieL..! daniele.pigned...@gmail.com: The `problem` is that i dont know if having so many indexes will raise problems as the data dimension grown. That seem to be not very efficient: http://explain.depesz.com/s/Q0m Well, this is slow, because for some reason postgres decided to use

Re: [GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread DaNieL..!
Yes, after my post i've tryed the versione with 2 separate table (a copy of the contact table) with inside just the employees, and, with my surprise, the query planner looks identical, both with 1 big table and with 2 splitted table. This sound a bit strange for me, becose in my test the

Re: [GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread Chris Spotts
-general- ow...@postgresql.org] On Behalf Of DaNieL..! Sent: Tuesday, June 23, 2009 9:44 AM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] Please suggest me on my table design (indexes!) Yes, after my post i've tryed the versione with 2 separate table (a copy of the contact table

Re: [GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread justin
DaNieL wrote: Hi guys, im tryin to optimize a simple table, suited for contain users. So, my table at the moment is: - CREATE TABLE contacts( id BIGSERIAL PRIMARY KEY NOT NULL UNIQUE, company_id BIGINT, code varchar(10), company_name varchar(120), name varchar(120), surname

Re: [GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread DaNieL..!
I thought to analyze the input chars to avoid useless searches, for example, if the digit is EX, where X is number, it is the user_code, and i'll search just that field; otherwise if the digit is an email, i'll look only at the email column. But, the things get little deeper, with the custom

Re: [GENERAL] Please suggest me on my table design (indexes!)

2009-06-23 Thread DaNieL..!
:44 AM To: pgsql-gene...@postgresql.org Subject: Re: [GENERAL] Please suggest me on my table design (indexes!) Yes, after my post i've tryed the versione with 2 separate table (a copy of the contact table) with inside just the employees, and, with my surprise, the query planner looks