Slow access
От | Tyson Oswald |
---|---|
Тема | Slow access |
Дата | |
Msg-id | 3831EC53.D5B285F3@iserv.net обсуждение исходный текст |
Список | pgsql-hackers |
Hello, Not sure is this is the place for this but, I have two object created a table (customers) and a view cust which joins customers and cust runs pretty slow when select count(*) from cust. I think it may be an index issue, can anyone help? there are about 1200 records in customers and it takes about 30 seconds to count(*). Also how to I create a foreign key constraint? Tyson Oswald Create table Customers ( id serial, Name varchar(25), UID varchar(7), Ext char(4), fkMailcode int4, fkContext int4, fkServer int4, fkAdmin int4 ); drop index idx_Customers_fkAdmin; drop index idx_Customers_fkMailcode; drop index idx_Customers_fkServer; drop index idx_Customers_fkContext; Create index idx_Customers_fkAdmin on Customers(fkadmin); Create index idx_Customers_fkMailcode on Customers(fkMailcode); Create index idx_Customers_fkContext on Customers(fkContext); Create index idx_Customers_fkServer on Customers(fkServer); Create table Codes(id serial,description varchar(50),type varchar(5),typecode varchar(5)); create view cust asselect c.name, c.ext, c.uid, tmail.description as mail, tcontext.description as context, tserver.descriptionas server, admins.name as admin, c.idfrom customers c, codes tmail, codes tserver, codes tcontext, adminswherec.fkadmin=admins.id and c.fkmailcode = tmail.id and c.fkcontext = tcontext.id and c.fkserver = tserver.id;
В списке pgsql-hackers по дате отправления: