Re: how to fix problem then when two queries run at the same time, it takes longer to complete then if run in sequence
В списке pgsql-performance по дате отправления:
| От | Craig Ringer |
|---|---|
| Тема | Re: how to fix problem then when two queries run at the same time, it takes longer to complete then if run in sequence |
| Дата | |
| Msg-id | 489192E0.9010309@postnewspapers.com.au обсуждение |
| Ответ на | Re: how to fix problem then when two queries run at the same time, it takes longer to complete then if run in sequence (Miernik <public@public.miernik.name>) |
| Список | pgsql-performance |
Miernik wrote: > BTW, doesn't there exist any tool does what "psql -c" does, but is > written in plain C, not perl? I was looking for such psql replacement, > but couldn't find any. As others have noted, psql is written in C, and you're using a wrapper. Assuming your're on Debian or similar you should be able to invoke the real psql with: /usr/lib/postgresql/8.3/bin/psql psql is a C executable that uses libpq directly, and is really rather low-overhead and fast. As for how to issue multiple commands in one statement in a shell script: one way is to use a here document instead of "-c". Eg: psql <<__END__ UPDATE blah SET thingy = 7 WHERE otherthingy = 4; DELETE FROM sometable WHERE criterion = -1; __END__ You can of course wrap statements in explicit transaction BEGIN/COMMIT, etc, as appropriate. As you start doing more complex things, and especially once you start wanting to have both good performance *and* good error handling, you'll want to move away from sql scripts with psql and toward using perl, python, or similar so you can use their native interfaces to libpq. -- Craig Ringer
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера